Discussion:
%SystemRoot% not being expanded??
(too old to reply)
Caesar Romano
2010-11-03 16:10:52 UTC
Permalink
Hello,

When I type " dfrg.msc" in it's "home" directory, e.g.

C:\WINDOWS\system32> dfrg.msc

I get the error message:

TCC: (Sys) The system cannot find the path specified.
"%SystemRoot%\system32\mmc.exe"

It looks to me like %SystemRoot% is not being expanded to "C:\windows

However

C:\WINDOWS\system32>echo %systemroot
correctly shows

C:\WINDOWS

I'm using

TCC 9.02.151 Windows XP [Version 5.1.2600]

Note: when I double-click dfrg.msc in Windows Explorer, the defrager
is correctly executed.

Has anyone seen this before?

Thanks for any comments.
--
Work is the curse of the drinking class.
Laurent Jumet
2010-11-03 17:42:11 UTC
Permalink
Hello Caesar !
Post by Caesar Romano
When I type " dfrg.msc" in it's "home" directory, e.g.
C:\WINDOWS\system32> dfrg.msc
TCC: (Sys) The system cannot find the path specified.
"%SystemRoot%\system32\mmc.exe"
It looks to me like %SystemRoot% is not being expanded to "C:\windows
However
C:\WINDOWS\system32>echo %systemroot
correctly shows
C:\WINDOWS
Sounds to me that variable is not expanded as expected when called with second command.
You should look in the registry what kind of value is in SystemRoot: String or Expanded?

The Environnement variable SystemRoot is not located with the others in:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\
--
Laurent Jumet - Point de Chat, Liège, BELGIUM
KeyID: 0xCFAF704C
[Restore address to laurent.jumet for e-mail reply.]
E. S. Fabian
2010-11-03 18:52:54 UTC
Permalink
---- Original Message ----
From: Caesar Romano
Newsgroups: comp.os.msdos.4dos
Sent: Wednesday, 2010. November 3. 12:10
Subject: %SystemRoot% not being expanded??

| Hello,
|
| When I type " dfrg.msc" in it's "home" directory, e.g.
|
| C:\WINDOWS\system32> dfrg.msc
|
| I get the error message:
|
| TCC: (Sys) The system cannot find the path specified.
| "%SystemRoot%\system32\mmc.exe"
|
| It looks to me like %SystemRoot% is not being expanded to "C:\windows
|
| However
|
| C:\WINDOWS\system32>echo %systemroot
| correctly shows
|
| C:\WINDOWS
|
| I'm using
|
| TCC 9.02.151 Windows XP [Version 5.1.2600]
|
| Note: when I double-click dfrg.msc in Windows Explorer, the defrager
| is correctly executed.
|
| Has anyone seen this before?
|
| Thanks for any comments.

No problems here using either TCC 9.02.157 (just a bit later than your
B151, available as a free download) or in TCC 12.00.32. From either version
the defragmenter is invoked. However, using the same filename as the
parameter to the SHORTCUT command ("shortcut dfrg.msc") does result in the
same error message. I think this issue shoud be brought up in the JPsoft TC
suport forum.
--
Steve
Caesar Romano
2010-11-03 20:00:54 UTC
Permalink
On Wed, 3 Nov 2010 14:52:54 -0400, "E. S. Fabian"
Post by E. S. Fabian
No problems here using either TCC 9.02.157 (just a bit later than your
B151, available as a free download) or in TCC 12.00.32. From either version
the defragmenter is invoked. However, using the same filename as the
parameter to the SHORTCUT command ("shortcut dfrg.msc") does result in the
same error message. I think this issue shoud be brought up in the JPsoft TC
suport forum.
Thanks Steve. I found a thread here
<http://jpsoft.com/forums/showthread.php?t=588&highlight=systemroot>
that is analagous to my problem, but the solution seems to be specific
to VBSfiles and I don't know enough about described solution to adapt
it to solving my problem.

Any suggestions?
--
Work is the curse of the drinking class.
E. S. Fabian
2010-11-03 21:34:33 UTC
Permalink
Caesar Romano:

| On Wed, 3 Nov 2010 14:52:54 -0400, "E. S. Fabian"
| <***@comcast.net> wrote Re Re: %SystemRoot% not being
| expanded??:
|
||
|| No problems here using either TCC 9.02.157 (just a bit later
|| than your B151, available as a free download) or in TCC 12.00.32.
|| From either version the defragmenter is invoked. However, using the
|| same filename as the parameter to the SHORTCUT command ("shortcut
|| dfrg.msc") does result in the same error message. I think this
|| issue shoud be brought up in the JPsoft TC suport forum.
|
| Thanks Steve. I found a thread here
| <http://jpsoft.com/forums/showthread.php?t=588&highlight=systemroot>
| that is analagous to my problem, but the solution seems to be
| specific to VBSfiles and I don't know enough about described
| solution to adapt it to solving my problem.
|
| Any suggestions?

Basically an imitation of the thread you mentioned. The issue is NOT
specific to VBSfiles. As that thread implies, whenever the VALUE of a
registry entry contains an environment variable, such as %SystemRoot%, the
entry TYPE must be REG_EXPAND_SZ, not REG_SZ (if the variable needs to be
expanded, i.e., its value and not its name are used). To determine what's in
my system, I first used the ASSOC command to determine the "filetype" the
.msc extension implies, and found it to be MSCFile. I then used REGEDIT to
search my registry for all occurrences of MSCFILE (the search is case
insensitive) and related subkeys. There were many with %SystemRoot%, but all
were the REG_EXPAND_SZ type, hence no problem on my system. I suggest you
follow the same method and check the entry types, and change them if
necessary. BTW, using the command "FTYPE mscfile" displayed
mscfile=C:\WINDOWS\system32\mmc.exe "%1" %*
which results from expanding the value
%SystemRoot%\mmc.exe "%1" %*
found in the registry, with type REG_EXPAND_SZ.
--
HTH, Steve
Caesar Romano
2010-11-03 23:35:07 UTC
Permalink
On Wed, 3 Nov 2010 17:34:33 -0400, "E. S. Fabian"
Post by E. S. Fabian
| On Wed, 3 Nov 2010 14:52:54 -0400, "E. S. Fabian"
|
||
|| No problems here using either TCC 9.02.157 (just a bit later
|| than your B151, available as a free download) or in TCC 12.00.32.
|| From either version the defragmenter is invoked. However, using the
|| same filename as the parameter to the SHORTCUT command ("shortcut
|| dfrg.msc") does result in the same error message. I think this
|| issue shoud be brought up in the JPsoft TC suport forum.
|
| Thanks Steve. I found a thread here
| <http://jpsoft.com/forums/showthread.php?t=588&highlight=systemroot>
| that is analagous to my problem, but the solution seems to be
| specific to VBSfiles and I don't know enough about described
| solution to adapt it to solving my problem.
|
| Any suggestions?
Basically an imitation of the thread you mentioned. The issue is NOT
specific to VBSfiles. As that thread implies, whenever the VALUE of a
registry entry contains an environment variable, such as %SystemRoot%, the
entry TYPE must be REG_EXPAND_SZ, not REG_SZ (if the variable needs to be
expanded, i.e., its value and not its name are used). To determine what's in
my system, I first used the ASSOC command to determine the "filetype" the
.msc extension implies, and found it to be MSCFile. I then used REGEDIT to
search my registry for all occurrences of MSCFILE (the search is case
insensitive) and related subkeys. There were many with %SystemRoot%, but all
were the REG_EXPAND_SZ type, hence no problem on my system. I suggest you
follow the same method and check the entry types, and change them if
necessary. BTW, using the command "FTYPE mscfile" displayed
mscfile=C:\WINDOWS\system32\mmc.exe "%1" %*
which results from expanding the value
%SystemRoot%\mmc.exe "%1" %*
found in the registry, with type REG_EXPAND_SZ.
Thanks for the help Steve, but I think I'm in way over my head here. I
did use RegEdit to search for occurrences of the string MSCFILE. I
located several instances, and in all cases the (Default) Type was
REG_SZ rather than REG_EXPAND_SZ. Double clicking (in RegEdit) on the
(Default) Name would allow me to change the "Data" value, but not the
"Type" value. From what I've read so far, it's this "Type" that needs
to be REG_EXPAND_SZ.

This is so far beyond me knowledge, that I think I can really screw
something up since I don't really know what I'm doing. I guess I'll
just live with it and use Windows Explorer to get it right when I need
to run a .msc file.

Thanks again for your kind help.
--
Work is the curse of the drinking class.
Loading...