如何检查从批处理脚本服务的启动类型
1个回答
展开全部
rem start a service, but only if it is configured as automatic, and only if it isn't running already
for /F "tokens=3 delims=: " %%H in ('sc qc %xxx% 1000^| findstr "START_TYPE"') do (
if /I "%%H" EQU "AUTO_START" (
尺或 rem check if service is stopped
for /F "tokens=3 delims=: " %%H in ('sc query %xxx% ^| findstr "STATE"') do (
if /I "%%H" EQU "STOPPED" (
echo net start %xxx%
net start %xxx%
陵唯伍 ) else (
echo %xxx% is already running
)
)
) else (
山唤echo Skipping %xxx% since it's not defined as automatic start
)
)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询