Skip navigation

JSI Tip 0996. How do I clear a System or User Environment variable from the CMD prompt?

To clear (empty the contents but not delete the variable) a System or User Environment variable from the CMD prompt, use SETX.EXE. The syntax is:

User Environment

SETX <Variable_Name> ""

System Environment

SETX <Variable_Name> "" -m

Exit the cmd prompt.

When you check using Control Panel / System / Environment, you will see that the <Variable_Name> is cleared.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish