%SystemRoot% and C:\WINDOWS in path

6

3

I have noticed my path variable includes references to the Windows directory in both %SystemRoot% and C:\Windows forms.

e.g. there exists a %SystemRoot%\system32 and a C:\Windows\system32 in the path variable.

  • Is it safe to remove one of the forms, and if so, which is it preferable to remove?
  • Is there any performance gain (no matter how minor) to be obtained from doing so?

vogomatix

Posted 2016-10-11T13:32:21.047

Reputation: 161

2The form in which path directories are added is up to the programs which add them. The environment variable form is marginally slower (very marginally), as it adds an environment look-up to the processing, but this is negligible compared with the time taken to search the directories for the file to be run. The environment form has the advantage that the look-up will still work if the disc letter should change (eg on adding another disc), though it is unlikely that the system will run without a lot of other modifications. Otherwise, there are no significant differences between the two forms. – AFH – 2016-10-11T13:59:18.283

Run for %G in ("%path:;=","%") do @echo "%~G" (paste the code to an open cmd prompt). If you can see %SystemRoot% in the output then there is something wrong… – JosefZ – 2019-08-27T19:40:48.550

No answers