无需重启更改系统环境变量

优势:
setx克服1024个字符的限制

PowerShell脚本

$newPath = 'f:\common tools\git\bin;f:\common tools\python\app;f:\common tools\python\app\scripts;f:\common tools\ruby\bin;f:\masm32\bin;F:\Borland\BCC55\Bin'
$oldPath = [Environment]::GetEnvironmentVariable('path', 'machine');
[Environment]::SetEnvironmentVariable('path2', "$($newPath);$($oldPath)",'Machine');

参考:
https://qastack.cn/superuser/387619/overcoming-the-1024-character-limit-with-setx

发布了18 篇原创文章 · 获赞 3 · 访问量 3958

猜你喜欢

转载自blog.csdn.net/Redboy_Crazy/article/details/104120093