Where is %SystemDrive%?

  • Thread starter Thread starter Steffen Haugk
  • Start date Start date
S

Steffen Haugk

Silly question: Where is %SystemDrive%?

For example
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SysmonLog\DefaultLogFileFolder
is set to

%SystemDrive%\PerfLogs

but where is that?


In contrast,
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Dfrg\PathName
is set to

%systemroot%\system32

and I know where %systemroot% is, because
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\SystemRoot
is set to

C:\WINNT

That makes sense.

I know it's kind of stupid, but I can't find %systemdrive%.

Thanks everyone.
Steffen
 
Steffen Haugk wrote in
Silly question: Where is %SystemDrive%?

For example
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SysmonLog\Defa
ultLogFileFolder is set to

%SystemDrive%\PerfLogs

but where is that?


In contrast,
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Dfrg\PathName
is set to

%systemroot%\system32

and I know where %systemroot% is, because
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\SystemRoot
is set to

C:\WINNT

That makes sense.

I know it's kind of stupid, but I can't find %systemdrive%.

Open a cmd.exe prompt.
Enter SET

The %systemdrive% should have a value of the "boot" drive. Often
this is "C:". The drive that contains %systemroot% (the Windows
Installation location).
 
There are no silly questions. Only silly people who refuse to ask when
they don't know.

%systemdrive% is where the primary boot volume and OS are. So if you
install it to the default it will be C:\

Cheers
Peter Z.
 
Steffen Haugk wrote in


Open a cmd.exe prompt.
Enter SET

The %systemdrive% should have a value of the "boot" drive. Often
this is "C:". The drive that contains %systemroot% (the Windows
Installation location).

I can not (or better, want not) run SET on a remote machine from my
program. I can happily connect to a remote computer's registry and get
%systemroot%.

I assume that %systemdrive% is the drive letter part of %systemroot%.
Although that makes sense, I wonder if that is the official way to do
it, and if that is the official way in which %systemdrive% is to be
interpreted.


Thanks for the reply.

Steffen
 
There are no silly questions. Only silly people who refuse to ask when
they don't know.

%systemdrive% is where the primary boot volume and OS are. So if you
install it to the default it will be C:\

It seems funny to use a variable %systemdrive% in the registry and not
defining it anywhere.

Thanks,
Steffen
 
In said:
It seems funny to use a variable %systemdrive% in the registry and
not defining it anywhere.

There are several variables that are created by the system at boot
time and are assigned dynamically. These are not defined (hard-
coded) anywhere. They are "defined" and visible in the local
machine's environment space. %systemdrive% is available if you can
read the local environment (on a remote system). psinfo.exe is an
example. psexec.exe is another way to see a "local" environment.

If you must read the remote registry to determine the "systemdrive" I
suggest
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\
SystemRoot=
(a REG_SZ) value. Then parse out the drive letter.
 
Thanks all,
I am satisfied I haven't missed anything. If systemroot is c:\winnt it
is kind of logical that systemdrive is c:, isn't it?

But why introducing it at all, when it is so obvious?
Why is systemroot not defined as &systemdrive%\winnt?

The weird world of Windows.

Thanks again,
Steffen
 
In said:
Thanks all,
I am satisfied I haven't missed anything. If systemroot is
c:\winnt it is kind of logical that systemdrive is c:, isn't it?

But why introducing it at all, when it is so obvious?
Why is systemroot not defined as &systemdrive%\winnt?

A good question to which I have not the answer. :-)

It may be (hypothetical) that this derives from design decisions made
in the original NT developement.
 
Good evening,

The folder is situated on the C;/ drive under the following:

C:\Users - Public - Public Documents

Regards,
 
Back
Top