Where is %SystemDrive%?

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
 
M

Mark V

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).
 
P

Peter Z.

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.
 
S

Steffen Haugk

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
 
S

Steffen Haugk

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
 
M

Mark V

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.
 
S

Steffen Haugk

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
 
M

Mark V

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.
 
Joined
Oct 25, 2022
Messages
1
Reaction score
0
Good evening,

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

C:\Users - Public - Public Documents

Regards,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top