Hi Richard,
but for the record I should mention that a
comment in that script is incorrect.
Any comments to the right of rem or :: should be ignored.
If you use >> anything to the right will be echoed in the command prompt.
I.e. >> Values 2/4/2007 of C:\autoexec.bat
If you use :: Values 2/4/2007 of C:\autoexec.bat
or rem Values 2/4/2007 of C:\autoexec.bat
it will be ignored as a comment.
The environmental variable Pathext shows a list of file extensions that are
considered to be executable and regulates which extensions do not need to be
typed in a Command or Run window.
What does PATHEXT show?
Open a command prompt, type: set hit Enter and scroll to PATHEXT.
At a minimum, PATHEXT should look something like this...
PATHEXT=.COM;.EXE;.BAT;.CMD
Mine has...
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
See My Pathext Experiment below. Way below. ;-)
You can add F:\PROGRA~1\MICROS~1.NET\Common7\Tools to your Environment
Variables.
System environment variables are in the following Registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\
Control\Session Manager\Environment
Fro Example... Value Name: Path & Value Name: PATHEXT
If you add to the PATH variable, by doing the following...
To view or change environment variables:
1. Right-click My Computer, and then click Properties.
2. Click the Advanced tab.
3. Click Environment variables.
4. Click one the following options, for either a user or a system variable:
* Click New to add a new variable name and value.
* Click an existing variable, and then click Edit to change its name or
value.
* Click an existing variable, and then click Delete to remove it.
from...
HOW TO Manage Environment Variables in Windows XP
http://support.microsoft.com/kb/310519
You can have F:\PROGRA~1\MICROS~1.NET\Common7\Tools show up any time when
you type path or set in a command prompt without having to set the path in
autoexec.bat. It will always be in the PATH.
If you set the path in the autoexec.bat, path probably gets added in this
registry key.
HKEY_CURRENT_USER\Volatile Environment
This registry key applies to current logon session and is not saved between
logoffs and
restarts.
---------------
My Pathext Experiment 27 August, 2006.
I just created a tracert.com in my System32 folder.
I opened a command prompt, typed: tracert /? and hit Enter.
This error message popped up...
---------------------------
C:\WINDOWS\system32\tracert.com
---------------------------
C:\WINDOWS\system32\tracert.com is not a valid Win32 application.
---------------------------
OK
---------------------------
I clicked OK and
Access is denied.
appeared in the command prompt.
-----
I still have the tracert.com that I created.
I removed everything from, my PATHEXT environment variable.
Opened a command prompt, typed: tracert and hit Enter.
I got the C:\WINDOWS\system32\tracert.com is not a valid Win32 application
error.
I clicked OK.
I got the Access is denied.
I typed: tracert.com and hit Enter.
I got the C:\WINDOWS\system32\tracert.com is not a valid Win32 application
error.
I clicked OK.
I got the Access is denied.
I typed: tracert.exe and hit Enter.
That command worked.
I deleted tracert.com.
I typed: tracert and hit Enter.
And it worked.
That confused me, so I typed: set and hit Enter.
PATHEXT still showed
=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
So I opened the Registry Editor and navigated to
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\
Session Manager\Environment
PATHEXT was empty.
I restored tracert.com to System32.
I rebooted.
I opened a command prompt, typed set and hit Enter.
PATHEXT showed
=.COM;.EXE;.BAT;.CMD;.VBS;.JS;.WS
I did a search for .COM;.EXE;.BAT;.CMD;.VBS;.JS;.WS in the registry.
Found nothing.
I did a search for .COM;.EXE;.BAT in the registry.
Found nothing.
Hmmm.
I put
..COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
back into PATHEXT environment variable.
PATHEXT is now OK in both
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\Environment
and
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment
I deleted tracert.com from System32.
--
Hope this helps. Let us know.
Wes
MS-MVP Windows Shell/User
In