Skip to content
⌘ NSIS Forum Archive

ReadEnvStr

4 posts

zwelgje#

ReadEnvStr

Hello out there,

I'm just starting with this fine install system, but i ran into a little problem.

for a certain application i need to get an environment variable, the help came up with this function:

4.9.2.9 ReadEnvStr
user_var(output) name
Reads from the environment string "name" and sets the value into the user variable $x. If there is an error reading the string, the user variable is set to empty, and the error flag is set.
But i can't get it to work properly, can somebody help me using this function??

Tnx in advance

grtz
evilO#
Hi !

Here is a little example, I hope it helps 🙂

Name "Example1"
OutFile "example1.exe"
Section ""
  ReadEnvStr $0 "COMSPEC"
  ReadEnvStr $1 "USERNAME"
  ReadEnvStr $2 "HOMEDRIVE"
  ReadEnvStr $3 "HOMEPATH"
  ReadEnvStr $4 "ALLUSERSPROFILE"
  ReadEnvStr $5 "LOGONSERVER"
 
 MessageBox MB_OK "COMSPEC: $0 $\r$\n USERNAME: $1 $\r$\n HOMEDRIVE: $2 $\r$\n HOMEPATH: $3 $\r$\n ALLUSERSPROFILE: $4 $\r$\n LOGONSERVER: $5"
SectionEnd 
evilO/Olive