@ECHO OFF for /f "skip=3 tokens=4" %%i in ('sc query OracleServiceORCL') do set "zt=%%i" &goto :next :next if /i "%zt%"=="RUNNING" ( ECHO 停止 Oracle 服务, 请等待 ... net stop OracleServiceORCL net stop OracleDBConsoleorcl net stop OracleOraDb11g_home3TNSListener )else ( ECHO 启动 Oracle 服务, 请等待 ... net start OracleServiceORCL net start OracleDBConsoleorcl net start OracleOraDb11g_home3TNSListener ) pause exit