Old 27th June 2012, 15:42   #1
mista-birdy
Junior Member
 
Join Date: Jun 2012
Posts: 1
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
code:
ExecWait 'SQLCMD ...'
?
mista-birdy is offline   Reply With Quote
Old 27th June 2012, 17:44   #2
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
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
Brummelchen is offline   Reply With Quote
Old 27th June 2012, 21:29   #3
msroboto
Junior Member
 
Join Date: Sep 2006
Posts: 47
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.
msroboto is offline   Reply With Quote
Old 28th June 2012, 00:12   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 28th June 2012, 00:13   #5
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,333
Quote:
Originally Posted by msroboto View Post
no current running program, Command Prompt or NSIS installer will pick that up automatically without being restarted.
Explorer picks up the new path...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump