|
|
#1 |
|
Junior Member
Join Date: Jun 2012
Posts: 9
|
How to set an environment variable in system variable
Hai,
I want to set the environment variable in system variable path for my application. How can I set that using nsis?........... ![]() For ex: C:\Program Files\Sample\bin, I want to set this path in System variable.. pls help me.. Thanks in advance... |
|
|
|
|
|
#2 |
|
Senior Member
|
Create cool looking Graphical Installers in NSIS: www.graphical-installer.com -see below I offer NSIS scripting, C/C++/C#/Delphi programming: www.unsigned-softworks.sk Develop NSIS projects directly in Visual Studio 2005-2012: www.unsigned-softworks.sk/visual-installer/ |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Jun 2012
Posts: 9
|
Hai,
Thank for your guidelines, I downloaded the plugin and update the SetEnv.dll in application path plugin folder. Also I tried the code the following code 1:The First Way ReadEnvStr $R0 "PATH" StrCpy $R0 "$R0;C:\MYAPP" System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("PATH", R0).r0' 2:The Second Way ReadEnvStr $R0 "PATH" StrCpy $R0 "$R0;C:\MYAPP" SetEnv::SetEnvVar "PATH" $R0 when I using the first way code, it writes the environment variable in user variable path but it won't write in system variable path. When I using the second way code, there is no effect on that code, it does not write the environment variable any where. But I want to set the environment variable as in System variable path. Pls suggest for that....... ![]() thanks in advance.....
|
|
|
|
|
|
#4 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,811
|
Changing %path% this way can corrupt the entire string if it is longer than the NSIS max string length. To be safe you should allocate and manipulate strings directly with the system plugin (kernel32::lstrcat)
IntOp $PostCount $PostCount + 1 |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|