一个script.bat可以更改Windows PATH环境变量 [英] Can a script.bat make changes to Windows PATH Environment Variable
问题描述
我想编写一个脚本,点击时将一对夫妇的条目添加的,而不是手动进行更改到Windows Path环境变量。我看到正在使用.bat文件的所有Windows上的时间的原因有多种,所以名为.bat脚本帮我类似的东西?
I'm trying to write a script that when clicked will add a couple of entries to the PATH Environment variable in Windows, instead of making the changes manually. I see .bat files being used all the time on Windows for a variety of reasons, so can a .bat script help me with something like that?
其实,我需要从一个位置下载的zip在互联网上,将其解压缩到一个指定位置,然后更新环境变量PATH中。所以任何提示AP preciated以前从来没有这样做。
I actually need to download a zip from a location on the Internet, extract it to a specified location, then update the PATH in environment variable. Never done this before so any hints appreciated.
推荐答案
如果你想在环境变量永久更改/更新的路径,可以使用命令SETX例如
If you wish to change/update the PATH permanently in the environment variable, you can use the SETX command e.g.
setx path "%PATH%;C:\New Folder"
有关%PATH%更多的细节信息和其他变量访问到系统文件夹,请参阅<一个href=\"http://vlaurie.com/computers2/Articles/environment.htm\">http://vlaurie.com/computers2/Articles/environment.htm
For more details information on %PATH% and other variables to access to system folder, refer to http://vlaurie.com/computers2/Articles/environment.htm
这篇关于一个script.bat可以更改Windows PATH环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!