What is %SystemRoot%

SystemRoot is the directory where the core of Microsoft Windows operating systems files are stored.

In a default installation of any version of Windows, the operating system files are located in C:\Windows. It is possible (but not recommended) to specify different locations for these files when you set up Windows.

The symbol %SystemRoot% is a built-in variable that can be used in Windows commands at the command line or in batch scripts such as logon scripts.

Normally, Windows Operating Systems are case insensitive: %SYSTEMROOT%, %SystemRoot%, and %systemroot% are identical.

For example, if your current directory during a command-line session on a machine running Windows is


and you want to change to the directory where the Windows operating system files are located, you can type

cd %systemroot%

%SystemRoot% is a built-in variable that stores a default value. Since Windows Vista, the default value of %SystemRoot% is


%SystemDrive% is also a buid-in variable with the default value of


How to check the value of %SystemRoot%?

Sometimes you may need to check the system root directory in order to find the drivers that are actually in use, to find the system log files, or for some other reason.

Type at the command prompt:

C:\>Set systemroot


Set SystemRoot
Type set systemroot at the command prompt

Difference between %SystemRoot% and %windir%

Some literature defines %SystemRoot% as an environment variable but the truth is that %SystemRoot% is not actually defined in the environment variable store at HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment in the registry.

%SystemRoot%, as also %SystemDrive%, is set during the installation process, when you choose the destination drive. We should call these types of variables built-in variables.

SystemRoot is not an Environment Variable, WinDir is.
%SystemRoot% is not an Environment Variable

On the other hand, %windir% is really an environment variable and is defined in the variable store as %SystemRoot%.

%windir% = %SystemRoot% = C:\Windows (set during OS installation)


Articles posted after being checked by editors.

Recent Posts