我的批处理代码在循环中运行。我不知道为什么
@ECHO OFF
REM Stop Service Adobe
:Adobestop
sc stop AdobeARMservice
REM Start Service Adobe
:Adobestart
sc start AdobeARMservice
REM Enable Fire wall rule Base1
:EnableBase1
netsh advfirewall firewall set rule name="Base1" new enable=yes
REM Disable Fire wall rule Base1
:DisableBase1
netsh advfirewall firewall set rule name="Base1" new enable=no
REM Step 1. disable fire wall rule Base1.
netsh advfirewall firewall show rule name=Base1 | find /I "Enabled" | find "Yes"
IF %ERRORLEVEL% NEQ 1 (
goto :DisableBase1
)
REM Step 2. Stop Adobe Service.
sc query AdobeARMservice | find /I "STATE" | find "RUNNING"
IF %ERRORLEVEL% NEQ 1 (
goto :Adobestop
)
REM Step 3. Start Adobe Service.
sc query AdobeARMservice | find /I "STATE" | find "STOPPED"
IF %ERRORLEVEL% NEQ 1 (
goto :Adobestart
)
REM Step 4. Enable fire wall rule Base1.
netsh advfirewall firewall show rule name=Base1 | find /I "Enabled" | find "No"
IF %ERRORLEVEL% NEQ 1 (
goto :EnableBase1
)
答案 0 :(得分:0)
%ERRORLEVEL%将为0。改变你的所有
IF %ERRORLEVEL% NEQ 1 (
到
IF %ERRORLEVEL% NEQ 0 (
也许有人正在测试错误检查,并没有将1还原为0。