@ echo off
: checkstart
3 tokens for/f "skip==4" % % I in (' sc query service name), do the set "zt=% % I" & amp; Goto: next
: next
If/I "zt % %==" "RUNNING" (goto checkag)
If/I zt "% %"=="STOPPED" (goto startsvr)
: startsvr
The echo time % %
Echo * * * * * * * * service to start * * * * * * * *
Echo service restart % % time, please check the system log & gt;> Restart_service. TXT
Sc config service name start=AUTO
Sc start service name
The set/p=. & lt; Nul
For/L % % I in (1, 1) do the set/p a=. & lt; Nul& Ping. Exe/n 2 127.0.0.1 & gt; Nul
Echo.
Echo Wscript. Sleep Wscript. The Arguments (0) & gt; TMP % % \ delay. The VBS
Cscript TMP////nologo b % % \ delay. The VBS 10000
Echo * * * * * * * * service start complete * * * * * * * *
Goto checkstart
: checkag
The echo time % % service running normally, after 10 seconds to continue to check..
Echo Wscript. Sleep Wscript. The Arguments (0) & gt; TMP % % \ delay. The VBS
Cscript TMP////nologo b % % \ delay. The VBS 10000
Goto checkstart
CodePudding user response:
Strives for the great god, in my best to change the above example, online, etcCodePudding user response:
Can't set loop statement, repeat itCodePudding user response:
How to set the @ paqie7201?