%windir% Null in batch files

G

GTS

The %windir% e-var is no longer being resolved in batch files which worked
properly on my XP Pro machine in the past. For example - regsvr32 /u
%windir%\system32\zipfldr.dll - fails showing the attempted path as
"\system32\system32\zipfldr.dll"

The trivial test batch file below will resolve %systemroot% but not %windir%
echo %windir%
echo %systemroot%

The proper windir content is shown as resident in the environment when a set
command is run in a command prompt.

I find no info on this for Windows XP. The symptoms are identical to that
described in "SMS: Command Fails When Running an Advertisement Using the
%windir% Environment Variable"
http://support.microsoft.com/default.aspx?scid=kb;en-us;235136 and the same
workaround can be used.

It's hard to say when this problem began. I suspect it may relate to a
critical update at some point, but it could go back some time before I
noticed it. (My biggest concern about this is whether this is likely to
occur at client's sites also where various batch files may use this e-var.)

Has anyone else observed the problem? Come across any information about it?
Thanks.
--
 
P

Pegasus \(MVP\)

GTS said:
The %windir% e-var is no longer being resolved in batch files which worked
properly on my XP Pro machine in the past. For example - regsvr32 /u
%windir%\system32\zipfldr.dll - fails showing the attempted path as
"\system32\system32\zipfldr.dll"

The trivial test batch file below will resolve %systemroot% but not %windir%
echo %windir%
echo %systemroot%

The proper windir content is shown as resident in the environment when a set
command is run in a command prompt.

I find no info on this for Windows XP. The symptoms are identical to that
described in "SMS: Command Fails When Running an Advertisement Using the
%windir% Environment Variable"
http://support.microsoft.com/default.aspx?scid=kb;en-us;235136 and the same
workaround can be used.

It's hard to say when this problem began. I suspect it may relate to a
critical update at some point, but it could go back some time before I
noticed it. (My biggest concern about this is whether this is likely to
occur at client's sites also where various batch files may use this e-var.)

Has anyone else observed the problem? Come across any information about it?
Thanks.
--

%SystemRoot% is the preferred variable for the location of the
Windows installation directory. %Windir% is really a legacy
variable. I suspect that you lose it because something clears it
in your current process.
 
G

GTS

Pegasus (MVP) said:
%SystemRoot% is the preferred variable for the location of the
Windows installation directory. %Windir% is really a legacy
variable. I suspect that you lose it because something clears it
in your current process.
I have checked a few other up to date XP machines and don't see the same
problem, so there's a certain logic to your idea, but testing doesn't seem
to support it. Thanks for the comment in any case.
 

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