Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On Unix operative systems I can start a process with additional environment variables like this:

$ DEBUG=1 VERBOSE=3 python

Does the Windows CMD have an equivalent for this? I'm stuck developing on a Windows computer and I want to test release-behaviour without having to build the project or permanently change the env variables in my CMD session.

share|improve this question

The closest thing you can get is the SET command. This is not a permanent command, and will revert when you open a new CMD session.

Example: SET variable=string

share|improve this answer
+1 That's cool, but it's not really equivalent of the Unix example. I want to set environment variables for one process, but SET changes the environment for the console. – Hubro Jan 31 '13 at 9:47

You'd need to wrap your command in a batch file and then use setlocal in it:


Setlocal makes all variable definition/changes local to that batch file.

Edit: You may use setlocal/endlocal to localize a single command, or set of commands in batch, but it does not work outside of batch. Full description of setlocal/endlocal

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.