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?


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:

  • 3
    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
  • 1
    You can also get to the Environment Variables by searching for "path" in the Start Menu. 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%
  • 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. 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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