How does a program know what drive the windows directory is in?

  • Thread starter Thread starter BLACKDOG157
  • Start date Start date
B

BLACKDOG157

I have a program that works with other programs. It needs to find a
data file of one of these programs that is in \windows\system32. How
do I find out what directory \windows\system32 is in on the customer's
computer?
Thanks,
B.D.
 
I have a program that works with other programs. It needs to find a
data file of one of these programs that is in \windows\system32. How
do I find out what directory \windows\system32 is in on the customer's
computer?
Thanks,
B.D.

for %a in (%comspec%) do @echo %~da
 
%windir%\system32 or %systemroot%\system32

%systemroot% is an environment variable that is the location of the Windows
root folder.

Typing or pasting %systemroot% into the Start | Run box opens to the Windows
folder on whatever drive it is located. I.e. C:\WINDOWS or C:\WINNT.

%windir% is an environment variable that is the location of the system
folder.

Typing or pasting %windir% into the Start | Run box opens to the Windows
folder on whatever drive it is located. I.e. C:\WINDOWS or C:\WINNT.

Windows XP can be installed in either WINDOWS or WINNT.

If %systemroot% and %windir% are the same, then obviously %windir% is easier
to type.

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
 
Yes it does help. Now I have to read up on how to get at environment
variables from visual basic.
Thanks.
 
There are API calls. BUT no user files should be in System32. Users don't have rights to modify or create files.
 
Back
Top