Skip navigation

JSI Tip 3739. Setx.exe freeware sets user and system environment variables.

NOTE: See SETENV.EXE is freeware replacement for SETX.EXE, and it has more functionality.

The Setx.exe command-line tool offers a batch method for setting environmental variables in the user or system environment and requires no programming or scripting.


In addition to taking an environmental variable and its associated value from the command line, it can also get the values of registrykeys and write them to text files.

SetX provides the only command-line or programmatic way to directly set system environment values for Microsoft Windows 2000. System environment variables are manually configureable through Control Panels or through a registry editor (Regedit or Regedt32). The SET command, which is internal to the command interpreter (Cmd.exe), sets only user environment variables for the current console window.

You can use SetX to set values for user and system environment variables from one of three sources: Command Line Mode, Registry Mode, or File Mode.

To display command-line options and details about syntax for all three modes, type:

setx /? or setx (without parameters)

For additional information and examples for all three modes, type:

setx -i

Hide 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.