hello,
I am new to the NSIS installer.During installation i need to set values for environment variables,like (classpath for java etc)
How do i do this,
thanks in advance
-vrunda
Setting Environment Variables
12 posts
This should do the trick:
Unless you want to temporarily set it for just the current process and sub-processes you will run from the installer and then you'll need:
Unless you want to temporarily set it for just the current process and sub-processes you will run from the installer and then you'll need:
hello,
could not make it work,i need to set the variable values for system variables,
with the following code
StrCpy $1 "value"
WriteRegStr HKU "Environment" "variable" $1
i am not able to set the values for the variable.but with same code i can set the value for current user variables.
how do i do this,
is any simple way out to this,other than .dll etc?
thanks
-Vrunda
could not make it work,i need to set the variable values for system variables,
with the following code
StrCpy $1 "value"
WriteRegStr HKU "Environment" "variable" $1
i am not able to set the values for the variable.but with same code i can set the value for current user variables.
how do i do this,
is any simple way out to this,other than .dll etc?
thanks
-Vrunda
hello,
thanks for the reply,but could not open the code link 🙁 FYI i am working on windows 2000 platform.
Why i am not able to set the variable values for all users(like other system variables) with the code
StrCpy $1 "value"
WriteRegStr HKU "Environment" "variable" $1
How do i do this?
thanks in advance
-Vrunda
thanks for the reply,but could not open the code link 🙁 FYI i am working on windows 2000 platform.
Why i am not able to set the variable values for all users(like other system variables) with the code
StrCpy $1 "value"
WriteRegStr HKU "Environment" "variable" $1
How do i do this?
thanks in advance
-Vrunda
HKU is not the right place to write it. I have created a new archive page that explains it all:
Have a look at the ALL_USERS define I have added, that's what you need.
Have a look at the ALL_USERS define I have added, that's what you need.
hello
not working on NT platform.
The code in the .nsi file is
!verbose 3
!include functions.nsh
!verbose 4
Section
Push "JAVA_HOME"
Push "c:\jdk"
Call WriteEnvStr
SectionEnd
Section uninstall
# remove the variable
Call un.DeleteEnvStr
SectionEnd
and the
.nsh file has the functions in the code given by you.
no error is generated,and still the value is not set. 🙁
How do i do this.
thanks in advance
-Vrunda
not working on NT platform.
The code in the .nsi file is
!verbose 3
!include functions.nsh
!verbose 4
Section
Push "JAVA_HOME"
Push "c:\jdk"
Call WriteEnvStr
SectionEnd
Section uninstall
# remove the variable
Call un.DeleteEnvStr
SectionEnd
and the
.nsh file has the functions in the code given by you.
no error is generated,and still the value is not set. 🙁
How do i do this.
thanks in advance
-Vrunda
According to this code the environment variable will be written into HKCU\Environment. You didn't define ALL_USERS before including functions.nsh. Are you sure it's not in HKCU\Environment? If it's not, attach your script and I will create a testing script for you.
hello,
sorry for the delay in reply.Was a bit busy in some other issues. the .nsi file code goes like this
;The name of the installer
Name "TEMP"
;The file to write
OutFile "Temp.exe"
InstallDir $WINDIR\Temp2
;Texts on the dialogs
InstType Typical
!define ALL_USERS
!verbose 3
!include "functions.nsh" ;includes the script provided by you
!verbose 4
Section "Add to path"
PUSH "USERDIR"
PUSH "c:/temp1"
Call WriteEnvStr
SectionEnd
Waiting for your reply
thanks in advance
-Vrunda Divekar
sorry for the delay in reply.Was a bit busy in some other issues. the .nsi file code goes like this
;The name of the installer
Name "TEMP"
;The file to write
OutFile "Temp.exe"
InstallDir $WINDIR\Temp2
;Texts on the dialogs
InstType Typical
!define ALL_USERS
!verbose 3
!include "functions.nsh" ;includes the script provided by you
!verbose 4
Section "Add to path"
PUSH "USERDIR"
PUSH "c:/temp1"
Call WriteEnvStr
SectionEnd
Waiting for your reply
thanks in advance
-Vrunda Divekar
Please try the latest NSIS, version 2.0b2. There was a bug with the defines.
Please get the latest code too as there was a "Control\" missing in the registry path. Together with NSIS 2.0b2 it should really work this time 😉 I have tested it yet again and it worked.
hello,
The new code you have given works well 🙂 thanks very much
thanks and regards
-Vrunda
The new code you have given works well 🙂 thanks very much
thanks and regards
-Vrunda