Environment Variables
Windows 2008 Server R2We are using a piece of software that in order to launch requires some system variables be set. IE, Station, Port, Extension and formcache. I have created a script to run and the variables do get set, I can test this by typeing set "variable" at the command prompt. The problem is when I launch the software, it does not recognize the variables as being set. Now I need to set up 15 different RDP sessions with different variables. Any idea how I can do this and have each session running on different variable values? I have tried both a batch file and a VBS script to no avail.
December 11th, 2009 10:15pm

Options:1) You can setup 15 different users with the envronment variables as need for each user. Read "Adding or Editing Environment Variables" in the following.http://vlaurie.com/computers2/Articles/environment.htm2) You can setup 15 different batch files with the environment variables that then LAUNCHES the application from the Batch file.The key to using the batch file is that the Batch file must launch the application, you can not launch the application via a shortcut. Basic Principal Any manually started command prompt allows LOCAL manipulation of the ENVIRONEMNT Variable in only that isolated command prompt. For example open two command prompts. In the first one type "SET Path=" to clear the path, in the other "Set Path=D:\;%path%". In both type "Set Path" to view the results. They are both different....but how can this be? By default, each time a process is started it receives a copy of the current system state, each can then modify that state independently of each other. Also, all processes launched from that parent CMD.exe are part of a Process Tree, and should inherit the ENVIRONEMENT Variable configuration of the launching process. Variations 1) Use a batch file to modify any Environemtn variable before launching any process. 2) Use a shortcut to launch a CMD process that runs a batch file 3) Use a shortcut to launch a Batch file 4) Use the Start command with or without the /I switch to launch processes with the current environment or with the original system environment.
Free Windows Admin Tool Kit Click here and download it now
December 12th, 2009 6:13am

If your software is not recognizing the environment variables even if it is being launched by the same script that set them, then you need to set the variables in the Volatile environment. This can done in a VB script. The following will set a collection of the Volatile environment: Set colVolatileEnvVars = objShell.Environment("Volatile")Then you can set individual elements: colVolatileEnvVars("HOMESHARE") = strHomeShare
December 12th, 2009 7:30am

Hi There,For VB script related issues, please do post your query under the official scripting forumhttp://social.technet.microsoft.com/Forums/en-US/category/scripting And Please follow Brian and Gunner suggestions and it depends how do you want to design your application.Few links which might be of interest are given belowhttp://msdn.microsoft.com/en-us/library/ms682653(VS.85).aspx http://www.mvps.org/vbvision/Sample_Projects.htm
Free Windows Admin Tool Kit Click here and download it now
December 12th, 2009 10:04am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics