0

Is there a batch file by which i can delete Environment Variable using cmd??

setx TEST "C:\" 

1 Answers1

0

You cannot delete an environment variable using setx, however, you can set it to NULL:

setx TEST ""

However, the variable is still there.

You can delete it using REG

REG DELETE "HKCU\Environment" /v TEST

However, using this approach, changes will not take place immediately.

ScriptKidd
  • 803
  • 1
  • 5
  • 19
  • I think this is what you're looking for: https://stackoverflow.com/questions/13222724/command-line-to-remove-an-environment-variable-from-the-os-level-configuration – ScriptKidd Feb 17 '20 at 11:02