The remote environment variable still works

I installed gcc, but then I found that the version of this gcc is slightly older (version 3.4.0). But I add its directory to the "Path" environment variable in Windows.

So, I removed this directory in path in environment variables in computer settings. But it still worked after I removed it. Whenever I tried to type gcc -v on the command line, it told me version 3.4.0 ...

I checked both the User Variable Path and the System Variable. No sign of this, but it still works. why?

+3


source to share


1 answer


When changing env var (s) (like you), from (for example) the Win Win interface (Control Panel -> System and Security -> System -> Advanced System Settings -> System Properties (Advanced) -> Environment Variables), it's good to know that only those applications that start after will see the changes; all applications already running will continue to work with the environment they had when they started. So, if you have changed some env var (s), you must restart any running application that depends on the changes. To keep everything safe, log out and log back in again (this means restarting all running applications) or better: restart your computer (if you want the env var (s) changes to propagate to running system services).



As for your gcc dilemma (it just works gcc still works), run where gcc

(which is equivalent to Ux which

) which will output the full path of gcc (using the same engine as the command interpreter when looking for an NFA). AFAIK where available from WinVista (at least it is present in Win7).

+1


source







All Articles