cmd设置环境变量可以方便我们bat脚本的运行,但是要注意的是变量只在当前的cmd窗口有作用,需要的朋友可以参考下

cmd设置环境变量可以方便我们bat脚本的运行,但是要注意的是变量只在当前的cmd窗口有作用(局部生效),如果想要设置持久的环境变量需要我们通过两种手段进行设置:一种是直接修改注册表,另一种是通过我的电脑-〉属性-〉高级,来设置系统的环境变量。

以下为NSIS常量(也可填写绝对路径),网抄而来仅供参考自行实践

$WINDIR=C:\Windows
$SYSDIR=C:\Windows\system32
$PROGRAMFILES=C:\Program Files (x86)
$PROGRAMFILES32=C:\Program Files (x86)
$PROGRAMFILES64=C:\Program Files
$COMMONFILES=C:\Program Files (x86)\Common Files
$COMMONFILES32=C:\Program Files (x86)\Common Files
$COMMONFILES64=C:\Program Files\Common Files
$RESOURCES=C:\Windows\resources
$RESOURCES_LOCALIZED=C:\Windows\resources\0804
$FONTS=C:\Windows\Fonts
;以下为当前用户
$PROFILE=C:\Users\Administrator
$DESKTOP=C:\Users\Administrator\Desktop
$TEMP=C:\Users\ADMINI~1\AppData\Local\Temp
$STARTMENU=C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Start Menu
$SMPROGRAMS=C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
$SMSTARTUP=C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
$QUICKLAUNCH=C:\Users\Administrator\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch
$SENDTO=C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\SendTo
$RECENT=C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Recent
$NETHOOD=C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Network Shortcuts
$TEMPLATES=C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Templates
$APPDATA=C:\Users\Administrator\AppData\Roaming
$LOCALAPPDATA=C:\Users\Administrator\AppData\Local
$PRINTHOOD=C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Printer Shortcuts
$INTERNET_CACHE=C:\Users\Administrator\AppData\Local\Microsoft\Windows\INetCache
$COOKIES=C:\Users\Administrator\AppData\Local\Microsoft\Windows\INetCookies
$HISTORY=C:\Users\Administrator\AppData\Local\Microsoft\Windows\History
$ADMINTOOLS=C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Administrative Tools
$CDBURN_AREA=C:\Users\Administrator\AppData\Local\Microsoft\Windows\Burn\Burn
$DOCUMENTS=C:\Users\Administrator\Documents
$FAVORITES=C:\Users\Administrator\Favorites
$MUSIC=C:\Users\Administrator\Music
$PICTURES=C:\Users\Administrator\Pictures
$VIDEOS=C:\Users\Administrator\Videos
;以下为所有用户
$PROFILE=C:\Users\Administrator
$DESKTOP=C:\Users\Public\Desktop
$TEMP=C:\Users\ADMINI~1\AppData\Local\Temp
$STARTMENU=C:\ProgramData\Microsoft\Windows\Start Menu
$SMPROGRAMS=C:\ProgramData\Microsoft\Windows\Start Menu\Programs
$SMSTARTUP=C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup
$QUICKLAUNCH=C:\Users\Administrator\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch
$SENDTO=C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\SendTo
$RECENT=C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Recent
$NETHOOD=C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Network Shortcuts
$TEMPLATES=C:\ProgramData\Microsoft\Windows\Templates
$APPDATA=C:\ProgramData
$LOCALAPPDATA=C:\Users\Administrator\AppData\Local
$PRINTHOOD=C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Printer Shortcuts
$INTERNET_CACHE=C:\Users\Administrator\AppData\Local\Microsoft\Windows\INetCache
$COOKIES=C:\Users\Administrator\AppData\Local\Microsoft\Windows\INetCookies
$HISTORY=C:\Users\Administrator\AppData\Local\Microsoft\Windows\History
$ADMINTOOLS=C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools
$CDBURN_AREA=C:\Users\Administrator\AppData\Local\Microsoft\Windows\Burn\Burn
$DOCUMENTS=C:\Users\Public\Documents
$FAVORITES=C:\Users\Administrator\Favorites
$MUSIC=C:\Users\Public\Music
$PICTURES=C:\Users\Public\Pictures
$VIDEOS=C:\Users\Public\Videos
Last modification:December 15th, 2020 at 04:30 pm
如果觉得我的文章对你有用,请随意赞赏