setting the environment path permanently

2020-07-24 04:04发布

I want to make a batch file for setting the %PATH% environment variable permanently - ie adding a value to the path permanently (in Windows XP).

4条回答
冷血范
2楼-- · 2020-07-24 04:09

You can use setx.exe to set environment variables from a batch file or command line. I believe it's included with Vista and 7. For XP, you can find it in the SP2 Support Tools.

查看更多
不美不萌又怎样
3楼-- · 2020-07-24 04:10

My-Computer - Properties, Advanced system settings -> environment variables. Set it there. (I hope that I got the right path here)

查看更多
太酷不给撩
4楼-- · 2020-07-24 04:16

you can use vbscript (or command line reg) to change the PATH environment variable

eg vbscript

    Set WshShell = WScript.CreateObject("WScript.Shell")
    strReg = "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\Path"
    strSetting = WshShell.RegRead(strReg)
    strNewSetting = strSetting&";c\test"  'insert path to current PATH
    WScript.Echo strNewSetting
    WshShell.RegWrite strReg, strNewSetting
查看更多
戒情不戒烟
5楼-- · 2020-07-24 04:28

On more recent OSes you can use setx which allows pretty fine-grained control as for where the variables are stored. Not available on XP, though, unless you install the Windows Server 2003 Support Tools.

查看更多
登录 后发表回答