Archive: system Environment Variable delete when uninstall


system Environment Variable delete when uninstall
in the script i use this:
ReadRegStr $0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path"
WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" "$0;$INSTDIR\bin"

to registry the system Environment Variable.So i also want to delete it when uninstaller is running.
but use the "DeleteRegValue
" will delete all the system Environment Variables,
what i want is only to delete the value "$INSTDIR\bin".
how to do it?


Use:

http://nsis.sourceforge.net/Path_Manipulation


Thank U first!


I'm using a much simpler method to add/remove path stuff. Here I'm adding (then removing in the uninstaller portion) PHP from the system path:


;Update the system path
ReadRegStr $R1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path"
${WordFind} "$R1" "$INSTDIR\php" "E+1{" $R0
StrCpy $R1 "$R1;$INSTDIR\php"
WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" "$R1"

;Remove system path
ReadRegStr $R1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path"
${un.WordReplace} "$R1" ";$INSTDIR\php" "" "+" $R1
WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" "$R1"