Archive: Refreshing Enviroment Variables


Refreshing Enviroment Variables
Hi all,
I'm started to work with NSIS. It's a great installer.
But I need a little help.

After installing SQL Server, the command sqlcmd should be available for calling from commandprompt. Because SQL Server add the Commandtool Path to Enviroment Vars.

But it i can't just call sqlcmd. I have to call the full path.
I think it's because NSIS have the old enviroments vars in cache.

How can I refresh this cache so that i can just call

ExecWait 'SQLCMD ...' 
?

nsis works "life" and dont cache anything - its on your system.

either you use the PATH-Variable for those commands (dos command) or AppPath in registry.
http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx

HTH


Right but let's say you change the PATH even manually no current running program, Command Prompt or NSIS installer will pick that up automatically without being restarted.

You can test that by opening a command prompt then changing your PATH.
The PATH is not reflected in that command prompt but if you open a new command prompt the new PATH or other environment variable will be available.

So the short answer is short of restarting the installer or starting a new installer you won't have access to the new PATH or other ENV variables.


Indeed environment variables are copied for each process on launch and therefore is up to that process to update its own environment variables if required. To do this you can use SetEnvironmentVariable in Kernel32.dll:
http://nsis.sourceforge.net/Setting_...taller_Process

(Note that page uses SetEnvironmentVariableA - it should just be SetEnvironmentVariable - System plug-in calls SetEnvironmentVariableA or SetEnvironmentVariableW accordingly).

Stu


Originally posted by msroboto
no current running program, Command Prompt or NSIS installer will pick that up automatically without being restarted.
Explorer picks up the new path...