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.
2I had to use: set path=c:\users;%path%
I needed the '=' to make it work. – Radim Cernej – 2016-01-23T00:33:00.307
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 – simpleuser – 2016-02-19T20:50:48.493
I suspect you would like quotation marks around that, as the PATH variable may contain spaces:
set path "c:\users;%path%"
– HelloGoodbye – 2016-03-15T09:33:05.1631To 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 – 2012-02-21T09:54:39.387