Solved Doing a Wait in Batch File

Hewlett-packard SERVER
September 11, 2009 at 15:37:42
Specs: Windows 2003 Server, Quad Core / 4Gig
I need a wait ability in a Batch file to wait for a service to stop before it continues to the next command. Here is my code...

sc stop "Backup Exec System Recovery"
del "C:\Documents and Settings\All Users\Application Data\Symantec\FileBackup\catalog.dat"
sc start "Backup Exec System Recovery"

I need a wait after the SC because it will not delete the file while the service is still running.

See More: Doing a Wait in Batch File

Report •

September 11, 2009 at 16:31:31
✔ Best Answer
If SC is a exe:

sc stop "Backup Exec System Recovery"
tasklist | find /i "sc.exe" >nul
if not %errorlevel%==1 goto :pause
del c:\.....

Report •

September 23, 2009 at 07:37:43
ricardo647's solution should work.

But if you want to wait a certain amount of time, you can do

PING -n 11 >NUL

That will simply ping your computer 11 times (starting now.)
It will cause the batch file to pause for 10 seconds.

Report •

Related Solutions

Ask Question