EnVar plug-in: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
(Created page with "{{PageAuthor|JasonFriday13}} == Links == Plugin package:<br> <attach>EnVar_plugin.zip</attach> [http://forums.winamp.com/showthread.php?t=377498 Forum thread] == Descripti...") |
No edit summary |
||
Line 6: | Line 6: | ||
<attach>EnVar_plugin.zip</attach> | <attach>EnVar_plugin.zip</attach> | ||
[http://forums.winamp.com/showthread.php?t= | [http://forums.winamp.com/showthread.php?t=389964 Forum thread] | ||
== Description == | == Description == |
Revision as of 04:44, 29 February 2016
Author: JasonFriday13 (talk, contrib) |
Links
Plugin package:
EnVar_plugin.zip (36 KB)
Description
Basically this plugin allows you to check for environment variables, check for paths in those variables, add and remove paths, and delete environment variables.
Just extract the contents to your nsis directory (usually '$PROGRAMFILES\NSIS').
Sample Usage
Name "EnVar Example" OutFile "EnVarExample.exe" RequestExecutionLevel User ShowInstDetails Show Page InstFiles Unicode True Section ; Check for write access EnVar::Check "NULL" "NULL" Pop $0 DetailPrint "EnVar::Check write access HKCU returned=|$0|" ; Set to HKLM EnVar::SetHKLM ; Check for write access EnVar::Check "NULL" "NULL" Pop $0 DetailPrint "EnVar::Check write access HKLM returned=|$0|" ; Set back to HKCU EnVar::SetHKCU DetailPrint "EnVar::SetHKCU" ; Check for a 'temp' variable EnVar::Check "temp" "NULL" Pop $0 DetailPrint "EnVar::Check returned=|$0|" ; Add a value EnVar::AddValue "ZTestVariable" "C:\Test" Pop $0 DetailPrint "EnVar::AddValue returned=|$0|" EnVar::AddValue "ZTestVariable" "C:\TestJas" Pop $0 DetailPrint "EnVar::AddValue returned=|$0|" ; Add an expanded value EnVar::AddValue "ZTestVariable1" "C:\Test" Pop $0 DetailPrint "EnVar::AddValue returned=|$0|" EnVar::AddValueEx "ZTestVariable1" "C:\Test" Pop $0 DetailPrint "EnVar::AddValue returned=|$0|" EnVar::AddValueEx "ZTestVariable1" "C:\TestVariable" Pop $0 DetailPrint "EnVar::AddValue returned=|$0|" ; Delete a value from a variable EnVar::DeleteValue "ZTestVariable1" "C:\Test" Pop $0 DetailPrint "EnVar::DeleteValue returned=|$0|" EnVar::DeleteValue "ZTestVariable1" "C:\Test" Pop $0 DetailPrint "EnVar::DeleteValue returned=|$0|" EnVar::DeleteValue "ZTestVariable1" "C:\TestJason" Pop $0 DetailPrint "EnVar::DeleteValue returned=|$0|" ; Delete a variable EnVar::Delete "ZTestVariable" Pop $0 DetailPrint "EnVar::Delete returned=|$0|" ; Try deleting "path", this should give an error EnVar::Delete "path" Pop $0 DetailPrint "EnVar::Delete returned=|$0|" SectionEnd