
查看环境变量
dir env:
dir env:"*data*"
dir env:Path
$env:Path
$env:Path -split ";"
gci env:多种方式设置环境变量
1、powershell设置
[Environment]::SetEnvironmentVariable("PATH", $Env:PATH + ";C:\test", [EnvironmentVariableTarget]::Machine)改命令中下划线的那部分,那个就是你要新增的

2、cmd设置
参考https://cloud.tencent.com/developer/article/old/1938509
3、微软20年前的小工具pathman.exe设置
参考https://cloud.tencent.com/developer/article/old/2287331
解压后方到C:\Windows即可,支持所有windows系统。
4、开源跨平台命令pathman
参考
https://git.rootprojects.org/root/pathman
https://github.com/webinstall/webi-installers/tree/main/pathman
5、执行sysdm.cpl等命令打开图形界面手动设置
cmd命令:
sysdm.cpl
control.exe sysdm.cpl,,3
rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,3
SystemPropertiesAdvanced.exe
rundll32.exe sysdm.cpl,EditEnvironmentVariablespowershell:
cmd /c "start rundll32 sysdm.cpl,EditEnvironmentVariables"
类似SystemPropertiesPerformance.exe /pagefile命令,SystemPropertiesAdvanced.exe加个什么参数直接打开编辑环境变量的界面?
答案不是SystemPropertiesAdvanced.exe /? 而是rundll32.exe sysdm.cpl,EditEnvironmentVariables
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。