Windows – Prepend to PATH variable (Windows)

pathwindows 7

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.

EDIT:

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

Best Answer

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 ';')

Related Question