Old 3rd October 2021, 17:57   #1
shekara
Junior Member
 
Join Date: Oct 2020
Posts: 33
append env varable only if it is not present

I need to append an env variable in Path along with a semi-colon. currently, I use
${EnvVarUpdate} $0 "PATH" "A" "HKLM" '$2'. $2 has path value. it works. however, I need to add; after path value. when I do this, it keeps adding every time when running the installer. I need to add it only if it is not present. there is no overwrite option in the EnvVarUpdate library. other than using conditions, is there any methd.
shekara is offline   Reply With Quote
Old 3rd October 2021, 18:29   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,418
The EnVar plug-in maybe?

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 4th October 2021, 01:39   #3
shekara
Junior Member
 
Join Date: Oct 2020
Posts: 33
i am using plugin itself
shekara is offline   Reply With Quote
Old 4th October 2021, 11:39   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,418
EnvVarUpdate is not the same as the plug-in

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 5th October 2021, 03:26   #5
shekara
Junior Member
 
Join Date: Oct 2020
Posts: 33
will check on this...Thank you
shekara is offline   Reply With Quote
Old 7th October 2021, 12:00   #6
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 916
If I remember correctly, EnVar strips the final semicolon off the end of the full string before it writes it. I don't know if older Windows cares if there is a semicolon on the end or not, but it works on windows 10 without a semicolon on the end.

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump