CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Main CFD Forum (
-   -   Windows XP Batch file help needed (

DL123 July 2, 2009 08:40

Windows XP Batch file help needed
I have a need to use a batch file to run windows update files (would prefer to use VB script, but unable too due to the method this has to be done, please don't ask me to explain).

I need for the batch to wait until the previous executable completes before running the next.

So far I have been successful using Start /w if I put nothing but start commands in the batch file, example:

Start /w <executable1> /quiet /noreset
Start /w <executable2> /quiet /noreset
etc...and this works

However, this batch assumes the files are present and only runs them sequentially.

I tried expanding the batch to check for the existance of the update first, and if present to skip to the next. If the update is not found, it copies the needed executable from a network share to the local PC and runs the executable, writes output to a file and then continues.

Unfortunately, it only partially works. Everything works up to the point of the first Start /w and then the command window closes and the executable never runs.

Here is the expanded code:


@Echo off

If Exist "C:\Windows\$NtUninstallKB961501$ goto B
Copy "\\<path to network share and the specific executable> <path to folder on local PC> "
CD "<Path where executable was copied to>"
echo KB961501 >> %computername%.txt
Start /w WindowsXP-KB961501-x86-ENU.exe /quiet /noreset
goto B

If Exist "C:\Windows\$NtUninstallKB968537$ goto COPFILE
Copy ""\\<path to network share and the specific executable> <path to folder on local PC>"
CD "<Path where executable was copied to>"
echo KB968537 >> %computername%.txt
Start /w WindowsXP-KB968537-x86-ENU.exe /quiet /noreset

copy %computername%.txt "<path to copy text file to>"
goto END



An obvious fix is to simply copy all of the updates to the local PC and then just run the batch file with all the start /w commands for each one, but that would run updates that may already exist and be inefficient, hence the desire to check and then copy/execute only the ones needed. Also, I have to do this for approximately 2500 PC's on the domain...

Any idea why everything fails when it gets to the first Start /w?

DL123 July 2, 2009 09:35

Okay, please disregard this question, I'm an idiot.

It's all working perfectly now....

I had the incorrect switch at the end of the executable...

It should be /norestart instead of /noreset...
and also I had an open parents on the path to the executable, but no close parents on the other end.


This is why I never aspired to be a programmer...

solefire July 3, 2009 08:53

:) this is funny!

All times are GMT -4. The time now is 02:32.