Computing.Net > Forums > Programming > /w command not working?

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

/w command not working?

Reply to Message Icon

Name: DL123
Date: July 2, 2009 at 05:29:04 Pacific
OS: Windows XP
Subcategory: Batch
Comment:

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
etc...

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

:A
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

: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
goto COPFILE

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

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



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: July 2, 2009 at 05:46:01 Pacific
Reply:

Why are you using START?


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

M2


0

Response Number 2
Name: DL123
Date: July 2, 2009 at 05:54:20 Pacific
Reply:

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?


0

Response Number 3
Name: DL123
Date: July 2, 2009 at 06:33:27 Pacific
Reply:

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...


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: /w command not working?

[BATCH] 'Ping' Command Not Working. www.computing.net/answers/programming/batch-ping-command-not-working/18615.html

Xcopy command is not working www.computing.net/answers/programming/xcopy-command-is-not-working/17730.html

FC command does NOT work in a batch www.computing.net/answers/programming/fc-command-does-not-work-in-a-batch/17859.html