delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/03/01/20:42:35

From: grantl AT deerinet DOT nb DOT ca (Grant Leslie)
Subject: Re: %USER% under Win95
1 Mar 1997 20:42:35 -0800 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <3318F64A.696A.cygnus.gnu-win32@deerinet.nb.ca>
References: <01BC2639 DOT 008D8FC0 AT supernova>
Mime-Version: 1.0
X-Mailer: Mozilla 4.0b2 (Win95; I)
Original-To: "David O'Shea" <s341595 AT student DOT uq DOT edu DOT au>,
GNU-Win32 <gnu-win32 AT cygnus DOT com>
X-Priority: 3 (Normal)
Original-Sender: owner-gnu-win32 AT cygnus DOT com

David O'Shea wrote:
> 
> Would anyone know of a program, or be able to write one, which would
> set the %USER% environment variable under Windows 95?  Or could someone
> tell me how to modify environment variables (the global ones, not the
> current process' ones)?
> 

	First you'll need to find the file winset.exe on the Win95 CD and place
it somewhere in your path.... This program works like the DOS set
command however it places the variable in the Global Enviroment.
	Now the following script should work... I tested it some on my own
computer. The computer MUST be logged on the network before this will
work.

#!/bin/sh
# First set USERNAME to the current username
export USERNAME=$(net config | grep User | tr -s ' ' | tr A-Z a-z | cut
-f 3 -d ' ' )

# This line will place the var USERNAME in the Global Enviroment
winset USERNAME=$USERNAME

# Now setup the HOME directory
export HOME=/home/$USERNAME
winset HOME=$HOME

# Create the appropriate /etc/passwd file
echo $USERNAME::500:500::$HOME:/bin/sh > /etc/passwd
-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019