The %SystemRoot% environment variable contains the path to the Windows directory. (e.g. c:\windows
)
SystemRoot
is not configured in Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
, it is automagically set.
Now, typically on Windows 10 this directory has the caseing C:\Windows
on NTFS disk.
After a script test(*) broke, we noticed:
- With same OS version Windows 10 (LTSC 1809 17763.3887)
- Some boxes use
%SystemRoot% == C:\WINDOWS
(all uppercase, despite the directory on-disk beingC:\Windows
) - Some boxes use
%SystemRoot% == C:\Windows
(case of dir on disk) - We cross checked with ProcessExplorer: The casing difference is already present in the environment block of the
wininit.exe
process, so it's not overridden somewhere.
Q:
Is the base for the value of SystemRoot
read from any specific registry key?
What could explain this difference?
(*): To be clear, the test was broken anyway - thou shall not rely on path casing on Windows.