walkerlala
walkerlala

Reputation: 1700

Deleted environment variable still work

I have installed a gcc, but afterward I discovered that the version of that gcc is kinda old.( version 3.4.0) But I have add its directory to the Path in windows' environment variable.

So, I went delete that directory in the path in environment variables in the computer setting. But it still worked after I deleted it. Whenever I tried to type gcc -v in the command prompt, it told me version 3.4.0...

I have checked both the Path of user variable and system variable. No sign of it , but it still work. why?

Upvotes: 4

Views: 3878

Answers (1)

CristiFati
CristiFati

Reputation: 41147

When modifying env var(s) (as you did), from (e.g.) the Win native interface (Control Panel -> System and Security -> System -> Advanced system settings -> System Properties (Advanced) -> Environment Variables), it's good to know that only the apps that start afterwards will see the changes; all the already running apps, will continue running with the environment they had at their startup. So, if you changed some env var(s), you should restart any running app that relies on the changes. To make things sure, log off and log on again (this implies restarting all running apps), or better: reboot your machine (in case you want the env var(s) changes to propagate to running system services as well).

As for your gcc dilemma (simply running gcc still works), run where gcc (which is the equivalent of Ux's which), which will output gcc's full path (using the same engine that the command interpreter does when locating gcc). AFAIK where is available since WinVista (at least it is present in Win7).

Upvotes: 2

Related Questions