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

前端 未结 7 1187
無奈伤痛
無奈伤痛 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:14

    Assuming I want to create a System Environment Variable called "ZIP_PROGRAM" and I want to point it to the executable at path "reg add C:\Program Files\7-Zip\7z.exe

    I will perform following at DOS Prompt:

    Step1: execute following code reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v ZIP_PROGRAM /t REG_SZ /d "C:\Program Files\7-Zip\7z.exe" /f

    Step2: Log Off then Login

    Step3: Open DOS Prompt and execute: "set z" and you should be able to see the System Environment Variable update

提交回复
热议问题