0
斷裂考慮以下批處理文件:CALL在爲
@echo off
set ORACLESERVER=ORAOP09
set ORACLEDB=OraDb11g_home1
set ORACLESERVICES.1 = OracleVssWriter%ORACLESERVER%
set ORACLESERVICES.2 = OracleDBConsole%ORACLESERVER%
set ORACLESERVICES.3 = Oracle%ORACLEDB%TNSListener
set ORACLESERVICES.4 = OracleService%ORACLESERVER%
AT > NUL
IF ERRORLEVEL 1 (
echo FATAL: THIS SCRIPT MUST BE RUN AS ADMINISTRATOR!
pause
exit
)
echo Stopping services...
FOR /F "tokens=2* delims=.=" %%A IN ('SET ORACLESERVICES.') DO sc stop %%B > NUL
FOR /F "tokens=2* delims=.=" %%A IN ('SET ORACLESERVICES.') DO call:check %%B
:check
sc query %1 | find /I "State" | find /I "STOPPED"
IF ERRORLEVEL 1 call:check %1
echo All services stopped successfully!
pause
exit
在第二FOR語句,當ERRORLEVEL = 0時,文件運行的其餘部分,而不是去到下一個FOR項目。我如何按預期做好這項工作?
謝謝!
你需要'轉到:eof'在您的子程序(它可以作爲一個'return'語句) – wmz 2012-08-13 12:06:39