cmd environment vars not expanded

J

John Smith

A problem just started on my system. When I open a cmd prompt window,
the PATH variable is not expanded in the environment, causing "'xxx' is
not recognized ... " errors. When I do "path" or "echo %PATH%", it
returns the unexpanded value, i.e.:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem...

If I enter "echo %SystemRoot%", it returns the proper setting for
SystemRoot, i.e. C:\WINDOWS.

I have no idea how this happened or how to fix it. Any help would be great.

Thanks,
M
 
N

Nepatsfan

In
John Smith said:
A problem just started on my system. When I open a cmd prompt
window,
the PATH variable is not expanded in the environment, causing
"'xxx' is
not recognized ... " errors. When I do "path" or "echo
%PATH%", it
returns the unexpanded value, i.e.:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem...

If I enter "echo %SystemRoot%", it returns the proper setting
for
SystemRoot, i.e. C:\WINDOWS.

I have no idea how this happened or how to fix it. Any help
would be great.

Thanks,
M

Check that the correct type of registry value is being used to
store the path.

Go to Start -> Run and enter regedit.exe in the Open box.
Click OK.
In the Registry Editor, navigate to the following key.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\Environment

Look in the right hand pane for the value entry for Path.
Check under the Type column. It should be REG_EXPAND_SZ.

If it's not, you need to delete the current value and create a
new one using the correct type.
Note: Before making this change, you might want to create a
System Restore point as well as backing up the registry key.
You can backup the key by right clicking on the Environment
key and selecting Export from the menu.
To repair the Path value, do the following.
Double click on Path.
In Edit String, right click on the Value data box and select
Copy from the menu.
Click OK to close Edit String.
Go back to the right hand pane and right click on Path.
Select Delete from the menu.
Once the current value is deleted right click an open spot in
the right hand pane and select New -> Expandable String Value
from the menu.
Name this new value Path.
Double click Path and paste the information you copied earlier
into the Value data box.
Close the registry editor.
You may have to restart your computer for the changes to take
effect.

Good luck

Nepatsfan
 
N

NickC

John Smith wrote on 07 Oct 2007:
A problem just started on my system. When I open a cmd prompt
window, the PATH variable is not expanded in the environment,
causing "'xxx' is not recognized ... " errors. When I do "path" or
"echo %PATH%", it returns the unexpanded value, i.e.:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem...

If I enter "echo %SystemRoot%", it returns the proper setting for
SystemRoot, i.e. C:\WINDOWS.

This implies that vars are being handled correctly, but that expansion
of PATH is not, so I guess the cmd.exe hasn't corrupted itself.

Has something ruined the syntax of the entries so that it won't parse
correctly? Installed any software recently? Especially have a look
that all the separators are ';' and not ',' and that you don't have a
double %% instead of %.
 
J

John Smith

Thanks to both of you, Nepatsfan and Nick. I could have had one or both
problems. I edited the PATH setting with the normal dialog and added
another directory at the end. This fixed the problem, somehow. Perhaps
the dialog corrected a problem with the previous string value or type in
the registry.

Thanks again,
JS
 

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