setting the environment path permanently

瘦欲@ 提交于 2019-12-04 15:03:52

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.

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

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

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!