Windows XP won't execute Batch program at all

Dell / Dell dv051...
October 7, 2010 at 06:58:00
Specs: Windows XP, 2.793 GHz / 2038 MB
I have been programming BAT files since 1982 and never seen this issue before. I am running XP and my batch files do not function properly. All my commands are ignored including:
SET PATH=
IF EXIST <filename>
GOTO
In addition, the command-line memory doesn't work on this machine. Usually I press PgUp to see and execute previous lines held in a buffer. Nothing is there.

How can WINDOWS work if there is no ability to execute commands in a batch file?

Here is the actual run. Even change drive fails:

C:\DOCUME~1\JOAN\DESKTOP>set path=c:\util;c:\windows\system32;c:\windows

C:\DOCUME~1\JOAN\DESKTOP>path
PATH=c:\util;c:\windows\system32;c:\windows

C:\DOCUME~1\JOAN\DESKTOP>set
ALLUSERSPROFILE=C:\DOCUME~1\ALLUSE~1
APPDATA=C:\DOCUME~1\Joan\APPLIC~1
BLASTER=A220 I5 D1 P330 T3
CLASSPATH=.;C:\Program Files\Java\jre1.6.0_05\lib\ext\QTJava.zip
COMMONPROGRAMFILES=C:\PROGRA~1\COMMON~1
COMPUTERNAME=DFM4JM91
ComSpec=C:\WINDOWS\system32\cmd.exe
FP_NO_HOST_CHECK=NO
HOMEDRIVE=C:
HOMEPATH=\Documents and Settings\Joan
LOGONSERVER=\\DFM4JM91
NUMBER_OF_PROCESSORS=2
OS=Windows_NT
PATH=c:\util;c:\windows\system32;c:\windows
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 15 Model 4 Stepping 9, GenuineIntel
PROCESSOR_LEVEL=15
PROCESSOR_REVISION=0409
PROGRAMFILES=C:\PROGRA~1
PROMPT=$P$G
QTJAVA=C:\Program Files\Java\jre1.6.0_05\lib\ext\QTJava.zip
SESSIONNAME=Console
SONICCENTRAL=C:\Program Files\Common Files\Sonic Shared\Sonic Central\
SYSTEMDRIVE=C:
SYSTEMROOT=C:\WINDOWS
TEMP=C:\WINDOWS\TEMP
TMP=C:\WINDOWS\TEMP
USERDOMAIN=DFM4JM91
USERNAME=Joan
USERPROFILE=C:\DOCUME~1\Joan

C:\DOCUME~1\JOAN\DESKTOP>r:

C:\DOCUME~1\JOAN\DESKTOP>path
PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\PROGRA~1\COMMON~
1\ROXIOS~1\DLLSHA~1\;C:\PROGRA~1\QUICKT~1\QTSyst

Notice that the PATH and SET commands inside the batch file seemed to work, but the change-drive command (R:) failed and the last line (PATH) entered immediately after the run shows the original path restored.

This seems impossible, but it's true. And rebooting made no difference.

I'm stumped. Anyone have some idea of what is happening, and how to fix it?

What makes it even stranger is that the little sub,bat program does work and does set up three SUBST drives


See More: Windows XP wont execute Batch program at all

Report •


#1
October 7, 2010 at 09:02:45
The behavior is odd, but you don't provide the script in question.

How To Ask Questions The Smart Way


Report •

#2
October 7, 2010 at 10:01:27
"How can WINDOWS work if there is no ability to execute commands in a batch file?"

Windows doesn't run on the command interpreter. [surprise]

My guess is that CMD is broke and a fresh copy is needed.

or maybe NTVDM

Note that SUBST is an external command.


=====================================
Helping others achieve escape felicity

M2


Report •

#3
October 7, 2010 at 13:22:05
Actually I did. The commends are echoed with the result, so you see it all. Here it is again in raw form:

set path=c:\util;c:\windows\system32;c:\windows
path
set
if not exist r:\*.txt call sub
r:


Report •

Related Solutions

#4
October 7, 2010 at 13:39:15
Oh, I take it you're using COMMAND, not CMD.
Yeah, that's how it works. I don't know why. I'd suspect running the script spawns a new instance of CMD that shares that console window, and then exits at the end of the script.

How To Ask Questions The Smart Way


Report •

#5
October 7, 2010 at 13:59:19
"Oh, I take it you're using COMMAND, not CMD."

Not if you believe the comspec var.

It might help to know what's in sub.


=====================================
Helping others achieve escape felicity

M2


Report •

#6
October 7, 2010 at 14:26:14
Not if you believe the comspec var.
It's full of lies, says I.
Thu 10/07/2010 17:24:43++
E:\Cpp\WinSDK>command
Microsoft(R) Windows DOS
(C)Copyright Microsoft Corp 1990-2001.


Thu 10/07/201017:24:49
E:\CPP\WINSDK>echo %comspec%
C:\WINDOWS\system32\cmd.exe

In a more serious note, it'd explain pretty much everything, including why his prompt is in 8.3 notation.

How To Ask Questions The Smart Way


Report •

#7
October 7, 2010 at 17:40:27
That the CMD commenad-line processor could be broken or corrupt is an interesting point. Since computers don't come with disks anymore, any idea where I'd download a correct CMD.EXE? Mine is dates 4/13/08 and was part of a service pack. Many thanks.

Report •

#8
October 7, 2010 at 17:57:18
I don't have XP but somebody here will.

Just for grins, save the current one and run an MD5 or CRC on new and old.


=====================================
Helping others achieve escape felicity

M2


Report •

#9
October 7, 2010 at 18:01:45
All fixed, thanks to hint from Mechanix2Go. Replaced CMD.EXE in system32 with the one in c:\windows\ServicePackFiles\i386 and it works fine.

Have no idea what killed CMD.EXE, but all's well that ends well. Thanks to all.


Report •

#10
October 7, 2010 at 18:04:57
"Have no idea what killed CMD.EXE"

Probably one of them little green electrons.


=====================================
Helping others achieve escape felicity

M2


Report •

Ask Question