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 installed Cygwin on my Windows XP machine. How can I add c:\cygwin\bin to the %PATH% in such a way that it persists?

My autoexec.bat is empty, and I assume it's no longer the right place for that. Where's the best place to do this?

share|improve this question
up vote 16 down vote accepted

Right click on my computer and select properties. In the Advanced tab, there is a button called Environment Variables. The PATH variable is in there, just add a semicolon and then the cygwin path to the end of the existing value, so it looks like this:

share|improve this answer
It's the Advanced tab. – random Aug 22 '09 at 7:35
Thx I just went blank on that and haven't got my windows pc switched on. – Col Aug 22 '09 at 7:48
You can also get to the Environment Variables by searching for "path" in the Start Menu. – Austin Moore Jul 14 '14 at 15:00

To add to your user profile path you can do the following from the command line using the setx command which is built into Windows Vista and above. In earlier versions of Windows you can use the Windows Resource Kit to get it.

Say Cygwin in installed in c:\cygwin, do:

SETX path c:\cygwin;c:\cygwin\bin;%path%

Or for you, as user only:

SETX -m path c:\cygwin;c:\cygwin\bin;%path%
share|improve this answer
It's probably better practice to add to the end of the existing path, not the start. If there are conflicts you probably want the original Windows binaries to run, to prevent issues with other programs that expect that. – Bob Oct 21 '12 at 3:02
Actually @bob in case I disagree. Cygwin is a environment on top of windows (essentially a shell), in this case I think it would be better to run the windows binaries second. In the case of other programs that are non 'replacing windows behaviours' then your suggestion hold water. – Preet Sangha Oct 21 '12 at 7:05
If you want to run cygwin binaries before Windows executables within the cygwin shell, you could modify the path in cygwin's .bashrc. I personally consider it safer to keep Windows' own binaries at the beginning of the path for any other Windows applications or tools, to reduce possible issues from conflicts. But that's the user's choice, in the end. – Bob Oct 21 '12 at 7:24

You must log in to answer this question.

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