Hi I have an infuriating issue with a simple batch file that I am running on a W2003 server. For simplicity it is doing something like this:
copy a b
call runprog.exe
if errorlevel 0 goto done
echo "error"
exit
:done
echo "ok"
This has been working for years, now suddenly, and only on 1 occasion out of 10, while it's just started running runprog.exe, control is returned to the batch file and it goes to the error condition. On the 9 other occasions out of 10, it doesn't return control until runprog.exe has finished (as expected).
I have reloaded runprog, and tried a fresh copy of c:\windows\system32\cmd.exe. I have also tried runprog.exe without the call - same results.
My conclusion is that something underlying in windows is corrupted and it needs fixing with SFC or a reload, but grateful for any ideas that wouldn't cause so much disruption here
many thanks
Rob
Intermittant batch file returns control too quickly
Moderator: DosItHelp
Re: Intermittant batch file returns control too quickly
Perhaps "runprog.exe" is writing to a disc and there is a bottle-neck and race hazards that cause errors.
I found on XP Home that directing StdOut and StdErr to the same text file could result in a conflict and loss of BOTH messages.
I noticed loss of less than 0.1% when the output text file was on system partition C:\.
I tested observational accuracy by changing the destination to a physically remote partition on the same HDD
and then data loss increased to 10% as predicted.
I solved the problem by disabling write caching to the system drive,
but that doubled the duration of a coffee break between switching on and Windows being ready to obey me
Perhaps "runprog.exe" is doing something else.
Whatever it is doing your system has now lost the ability to keep up.
My number one suspect is always a Microsoft Security patch - especially the unexpected emergencies that pounce and install without warning.
Incidentally, you can CALL a batch file.
I am not sure of the validity of calling an EXE, perhaps you could try some variation of
START /WAIT RUNPROG.EXE
I found on XP Home that directing StdOut and StdErr to the same text file could result in a conflict and loss of BOTH messages.
I noticed loss of less than 0.1% when the output text file was on system partition C:\.
I tested observational accuracy by changing the destination to a physically remote partition on the same HDD
and then data loss increased to 10% as predicted.
I solved the problem by disabling write caching to the system drive,
but that doubled the duration of a coffee break between switching on and Windows being ready to obey me

Perhaps "runprog.exe" is doing something else.
Whatever it is doing your system has now lost the ability to keep up.
My number one suspect is always a Microsoft Security patch - especially the unexpected emergencies that pounce and install without warning.
Incidentally, you can CALL a batch file.
I am not sure of the validity of calling an EXE, perhaps you could try some variation of
START /WAIT RUNPROG.EXE