View Single Post
Old 15th July 2015, 18:57   #10
Major Dude
LoRd_MuldeR's Avatar
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
It's very bad idea to extend %PATH% like this. That's because NSIS strings are limited to a length of 1024 chars (might be a bit longer, if you use "long string" special build). This means you will easily end up with truncated %PATH%, if your %PATH% happens to be long.

Why work with %PATH% anyway? It's highly unreliable to launch a program without a full path and hope that the system will pick up the proper program from %PATH% (or whatever the "current directory" happens to be). Use a fully-qualified path whenever you can!

I suggest you do something like this, if possible for your situation:
ReadRegStr $0 HKCU "Software\Node.js" "InstallPath"
Exec[Wait] '"$0\node.exe" your_parameters_here'

Note this info from Microsoft documentation on CreateProcess() function:

If the file name does not contain a directory path, the system searches for the executable file in the following sequence:
  1. The directory from which the application loaded.
  2. The current directory for the parent process.
  3. The 32-bit Windows system directory.
  4. The 16-bit Windows system directory.
  5. The Windows directory.
  6. The directories that are listed in the PATH environment variable.

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration:

Last edited by LoRd_MuldeR; 15th July 2015 at 21:56.
LoRd_MuldeR is offline   Reply With Quote