windows SET 和 SETX 都不设置 %PATH% 的值

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7461667/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 18:06:26  来源:igfitidea点击:

either SET and SETX do not set the value of %PATH%

windowspathbatch-filecmd

提问by Eugeny89

I'm executing the following command

我正在执行以下命令

SETX PATH "very_very_long_list";

after closing and opening comand line, echo %path%outputs the old value. What I'm doing wrong?

关闭和打开命令行后,echo %path%输出旧值。我做错了什么?

Thank you in advance!

先感谢您!

回答by Mechaflash

No need to use SETX PATH. If you need to add onto the current PATH, use

无需使用SETX PATH. 如果您需要添加到当前PATH,请使用

PATH=%PATH%;C:\another path\;C:\yet\another path\

Else if you need to wipe PATH completely and then add in your own parameters use

否则,如果您需要完全擦除 PATH 然后添加您自己的参数,请使用

PATH=C:\path\;C:\another path\;C:\yet\another path\

No need to surround paths with double quotes as PATHcommand sees spaces in pathnames.

无需用双引号PATH将路径括起来,因为命令会在路径名中看到空格。