Command line to remove an environment variable from the OS level configuration

前端 未结 9 1158
闹比i
闹比i 2020-11-30 17:11

Windows has the setx command:

Description:
    Creates or modifies environment variables in the user or system
    environment.

So you can

9条回答
  •  无人及你
    2020-11-30 18:02

    setx FOOBAR ""
    

    just causes the value of FOOBAR to be a null string. (Although, it shows with the set command with the "" so maybe double-quotes is the string.)

    I used:

    set FOOBAR=
    

    and then FOOBAR was no longer listed in the set command. (Log-off was not required.)

    Windows 7 32 bit, using the command prompt, non-administrator is what I used. (Not cmd or Windows + R, which might be different.)

    BTW, I did not see the variable I created anywhere in the registry after I created it. I'm using RegEdit not as administrator.

提交回复
热议问题