Archive: Problem with OS seeing PATH change


Problem with OS seeing PATH change
I'm having a problem where Windows 2000 does not recognize a path change when I'm using the typical path manipulation scripts in the archive or when using pathman.exe. Both make the call to the OS to refresh its environment, but when my script executes something that should be in the path it fails.

I'm wondering if, when setting the path within a function, the section that calls the function does not see the new environment/path.

My code looks something like this


SubSection Splat

Section Woo
Call InstPerl
nsExec::ExecToLog 'Perl "$EXEDIR\Scripts\AutoInst.pl"'
SectionEnd

Section Hoo
blah blah...
SectionEnd

SubSectionEnd

Function InstPerl
ExecWait 'msiexec.exe /i "$EXEDIR\ActivePerl.msi" /l*v C:\SUlogs\Perl.log /qb'
Push "C:\Perl\Bin"
Call AddToPath ; Same as Path Manip scripts in NSIS Archive
;Alternatively, I've tried the following
;nsExec::ExecToLog '"$EXEDIR\UTILS\pathman" /as "C:\Perl\Bin"'
FunctionEnd


Thanks in advance to anyone who can shed some light on this. =)

Did you reboot your system?


Use this one instead:

http://nsis.sourceforge.net/archive/...php?pageid=161

Make sure you call it before you execute that application.


setenv.dll did not work

I need this to work without rebooting the system. My issue is the the line "nsExec::ExecToLog 'Perl "$EXEDIR\Scripts\AutoInst.pl"'" will not execute unless C:\Perl\Bin is in the path. I know I can work around this in several ways, but I need the path to work while the installer is running.


SetEnv.dll works fine for me. For example:

ReadEnvStr $R0 "PATH" 
StrCpy $R0 "$R0;F:\Perl\Bin"
SetEnv::SetEnvVar "PATH" $R0
nsExec::ExecToLog `perl.exe -e "print 'hello world';"`
Pop $0 # return value/error/timeout
DetailPrint ""
DetailPrint " Return value: $0"
DetailPrint ""
Attach your complete script for testing.