Hi,
I'm trying to work out how to use an environment variable
as the source directory in an NSIS script
ExpandEnvStrings $0 "HIL_DEVELOP"
SetOutputPath "$INSTDIR\test"
File "$0\test\test.exe"
This just doesn't seem to work. NSIS doesn't seem to expand
$0 (assuming that ExpandEnvStrings works).
BTW is there any documentation describing the syntax used
in the NSIS Manual? I'm having real problems trying
to understand the syntax of some NSIS Instructions
eg.
4.9.2.7 ExpandEnvStrings
user_var(output) string
Expands environment variables in "string" into user variable $x.
Usage: ExpandEnvStrings $(user_var: output) string
Firstly, we have two apparently different syntaxes!
Secondly where is $x mentioned in syntax (I presume that
the description should say user_var rather than $x)?
What the %$@#&* is output?
Using Env Var as source directory
3 posts
I think you have to wrap your Env Var in ${ }
Try:
ExpandEnvStrings $0 ${HIL_DEVELOP}
Output is $0 in your case, that should work.
Try:
ExpandEnvStrings $0 ${HIL_DEVELOP}
Output is $0 in your case, that should work.
Crap - tried that to make sure, and it don't work...
This syntax does:
$%HOMEPATH%
Bury your env var inside the %'s and use it inside quotes.
Like: File "$%HIL_DEVELOP%\test\test.exe"
Or: StrCpy $0 "$%HOMEPATH%" to set $0 to be your var.
This syntax gets replaced at compile-time, so make sure you have the Env Var defined correctly when you compile.
This syntax does:
$%HOMEPATH%
Bury your env var inside the %'s and use it inside quotes.
Like: File "$%HIL_DEVELOP%\test\test.exe"
Or: StrCpy $0 "$%HOMEPATH%" to set $0 to be your var.
This syntax gets replaced at compile-time, so make sure you have the Env Var defined correctly when you compile.