Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Environmental Variables

Status
Not open for further replies.

K1ng

Programmer
Jul 2, 2002
2
GB
Hello,

I'm currently doing some programming on a 2000+ user NT network. I'm using REXX to create a script that updates user profile paths and script paths automatically based on a current users setup.

With each user, there are four things to change.
- The Profile Path
- The Script Path
- Home Directory
- Group memberships

The program is working great and is almost all working, I say almost because I have a slight problem.

Users profile path is something like this...

\\SERVER\PROFILES\PREP\BUSINESS_3.1

Although, as a backup we are trying to set the profile path to...

%LOGONSERVER%\PROFILES\PREP\BUSINESS_3.1

But anytime I try and pass the environmental variable to the following DOS command...

NET USER <username> /DOMAIN PROFILEPATH:<profile path>

I get an error &quot;you enterred an invalid value for the /profilepath option&quot;.

The users home directory is set to...

G:\%USERNAME%

And this works fine.

I have checked the environmental variable exists and that the command works when typed manually into dos so does anyone know whats wrong here?

Thanks in advance for any help.
K1ng
 
Here's an example of how I trap the username and then use it in a command.

username = value('username',,'ENVIRONMENT')
cmd = 'cd /D C:\Documents and Settings\' || username || '\Favorites\'
cmd

I'm unsure how to get the servername.
 
The only problem with that is that I dont want my username to be in the script, if I use: -

username = value('username',,'ENVIRONMENT')

Then the variable 'username' becomes equal to the current %username% which is mine, so everyone in the company would then be logging on to MY logon drive. What I want is a way to pass the actuall string: -

%USERNAME%

To the command and not the contents of the environmental variable.

K1ng
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top