How can I add cygwin/bin to the search path in Windows XP?

7

0

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?

Nathan Fellman

Posted 2009-08-22T07:23:31.717

Reputation: 8 152

Answers

18

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:

C:\WINDOWS\system32;C:\WINDOWS\;C:\WINDOWS\System32\Wbem;...;c:\cygwin\bin

Col

Posted 2009-08-22T07:23:31.717

Reputation: 6 995

1You can also get to the Environment Variables by searching for "path" in the Start Menu. – Austin Moore – 2014-07-14T15:00:39.210

3It's the Advanced tab. – random – 2009-08-22T07:35:28.793

Thx I just went blank on that and haven't got my windows pc switched on. – Col – 2009-08-22T07:48:42.370

3

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%

Preet Sangha

Posted 2009-08-22T07:23:31.717

Reputation: 1 126

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 – 2012-10-21T03:02:20.377

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 – 2012-10-21T07:05:46.690

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 – 2012-10-21T07:24:43.833