/w command not working?

July 2, 2009 at 05:29:04
Specs: Windows XP
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 ot 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

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 C
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?

See More: /w command not working?

Report •

July 2, 2009 at 05:46:01
Why are you using START?

If at first you don't succeed, you're about average.


Report •

July 2, 2009 at 05:54:20
I understand the start /w combo is what is needed in batch to run the executable and have it wait until the executable finishes before moving on.

Is this not correct? is there another command to use instead that would be better?

Report •

July 2, 2009 at 06:33:27
ok, disregard this entire post...I'm an idiot...

It works perfectly now, the problem was the switch I had on running the executable...

It should be /norestart instead of /noreset....duh..

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

Report •

Related Solutions

Ask Question