tsando
tsando

Reputation: 4717

Unable to remove cygwin from PATH environment variable

I recently had to reinstall Cygwin and in doing so, I have ran into a problem with some application because Cygwin seems to be appended to my PATH environment variable. I have tried to remove this by following these instructions https://www.java.com/en/download/help/path.xml but something strange happens. If I look at the value of Path under 'Environment Variables', Cygwin is not there; however if I type PATH in cmd.exe, I see Cygwin gets appended at the end of the PATH. Can you please help me to know to remove Cygwin from the PATH?

As an example, this is what I see in the Environmental Variables window Path value:

Path=C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;c:\Oracle\11g_R2_x64\Administrator\11.2.0\client_1\bin;C:\ProgramData\Oracle\Java\javapath;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;%systemroot%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;%systemroot%\System32\WindowsPowerShell\v1.0\;C:\Apps\Anaconda3;C:\Apps\Anaconda3\Scripts;C:\Apps\Anaconda3\Library\bin

And this is what I see in cdm.exe:

PATH PATH=C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Clien t\;c:\Oracle\11g_R2_x64\Administrator\11.2.0\client_1\bin;C:\ProgramData\Oracle\ Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS \System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C: \Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Int el(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Man agement Engine Components\IPT;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\App s\Anaconda3;C:\Apps\Anaconda3\Scripts;C:\Apps\Anaconda3\Library\bin;C:\blp\DAPI; C:\blp\DAPI\DDE;C:\Apps\cygwin64\bin

As you can see, I have Cygwin in the second case, whereas I don't have it on the first case.

UPDATE:

Thanks to Patrick for his answer below. Just to complement, in Windows you should be able to edit both the user and system environment variables from the Control Panel as in this screenshot:

enter image description here

Upvotes: 2

Views: 2195

Answers (2)

shrimpus
shrimpus

Reputation: 1

My problem was different, but still led me here, so hopefully someone else might benefit from this. In my case, C:\cygwin64\bin was NOT present in either the user variables PATH or the System variables PATH. However, whenever I ran python it was using the executable stored in C:\cygwin64\bin instead of the location I had python installed to. (This was confirmed by running Get-Command python | Select-Object -ExpandProperty Definition in PowerShell).

It turned out my problem was that for whatever reason my System variables Path also contained C. Yes, just C. Removing this effectively removed C:\cygwin64\bin from my Path (and anything else the root C:\ directory).

So if you're having an issue like this where something that's NOT in your path is behaving as if it is, maybe check if that item's parent directory has been added.

Upvotes: 0

Patrick Kelly
Patrick Kelly

Reputation: 1381

There are two PATH variables in Windows. Both are available on that page for environment variables. One is in the top pane (User variables) and the other is in the second pane (System variables). They are both called PATH, but they are separate and distinct entities. When you launch cmd.exe, the PATH variable you end up with is the result of combining those two variables. To fix the problem you are seeing here, return to the Environment Variables pane and check both versions (User and System). Based on your PATH variables above, I suspect the User PATH will contain the following three entries:

C:\blp\DAPI; 
C:\blp\DAPI\DDE;
C:\Apps\cygwin64\bin

That's the only functional difference in your cmd.exe PATH and the other on after variables like SYSTEMROOT are expanded. You should be able to delete the Cygwin directory there.

Upvotes: 1

Related Questions