Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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

I want to prepend a directory to the windows path (I am running Windows 7 64-bit). However I can not find any way to do this:

  • Changing the PATH variable via the GUI is not working as it is always appending.
  • Changing the PATH with setx does not prepend neither:

    setx PATH "new_dir:%PATH%"

However I need the path prepended, because I want to add the gnu_utils directory before any other directory so Windows uses the gnu find when running find, and not it's own find alias.

Installing Cygwin and using BASH unfortunately is not an option.


I think I should have clarified that I also can not modify the System PATH - only the user PATH.

share|improve this question
up vote 5 down vote accepted

Typing PATH /? in a cmd window gives me this:

[...] Including %PATH% in the new path setting causes the old path to be appended to the new setting.

In my case (Belgian environment) I can use this command:

set path c:\users;%path%

and c:\users is prepended to the existing path

Take care to use the correct list separator (I have to use ';')

share|improve this answer
To make it work in the current CMD prompt your command was enough - to make it work in Powershell I had to use the following command (I wonder why I did not find it when searching for it in the first place): $env:Path="<dir>;$env:Path" – Gjallar Feb 21 '12 at 9:54
I had to use: set path=c:\users;%path% I needed the '=' to make it work. – Radim Cernej Jan 23 at 0:33
note that this does not work in the "Environment Variables" UI of the "System Properties" configuration in Windows 10. you just end up with two copies of the system Path – user9999999 Feb 19 at 20:50
I suspect you would like quotation marks around that, as the PATH variable may contain spaces: set path "c:\users;%path%" – HelloGoodbye Mar 15 at 9:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .