How to persistently set a variable in Windows 7 from a batch file?

前端 未结 7 1192
無奈伤痛
無奈伤痛 2020-12-02 08:38

I am trying to set the PATH environment variable in windows 7 using a bat-file; however it does not seem to work.

I am using this windows command:

se         


        
7条回答
  •  我在风中等你
    2020-12-02 09:28

    If you want to do it in a batch file, use the reg command to change the path value in the registry at the HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment key.

    Something like:

    reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v Path /t REG_SZ /d "%path%;c:\newpath"
    

    Check that the path in the %path% variable matches the system path.

提交回复
热议问题