Oracle批处理命令:
:doit
@echo off
set /p xz=按"s"键启动服务......按"e"关闭服务
if %xz%==s goto s
if %xz%==e goto e
goto doit
:s
@echo off
echo 正在启动oracle服务,请稍等.......
net start OracleOraDb11g_home1TNSListener
net start OracleServiceMYORCLE
net start OracleOraDb11g_home1ClrAgent
net start OracleMTSRecoveryService
net start OracleVssWriterMYORCLE
echo 启动oracle服务完成
echo.&pause
goto doit
:e
@echo off
echo 正在关闭oracle服务,请稍等.......
net stop OracleOraDb11g_home1TNSListener
net stop OracleServiceMYORCLE
net stop OracleOraDb11g_home1ClrAgent
net stop OracleMTSRecoveryService
net stop OracleVssWriterMYORCLE
echo 关闭oracle服务完成
echo.&pause
goto doit
SqlServer服务:
:doit
@echo off
set /p xz=按"s"键启动服务......按"e"关闭服务
if %xz%==s goto s
if %xz%==e goto e
goto doit
:s
@echo off
echo 正在启动sqlServer服务,请稍等......
net start ReportServer$MY_SQL_SERVER
net start MsDtsServer
net start msftesql$MY_SQL_SERVER
net start SQLBrowser
net start MSOLAP$MY_SQL_SERVER
net start SQLAgent$MY_SQL_SERVER
net start MSSQL$MY_SQL_SERVER
echo 启动sqlServer服务完成
echo.&pause
goto doit
:e
@echo off
echo 正在关闭sqlServer服务,请稍等......
net stop ReportServer$MY_SQL_SERVER
net stop MsDtsServer
net stop msftesql$MY_SQL_SERVER
net stop SQLBrowser
net stop MSOLAP$MY_SQL_SERVER
net stop SQLAgent$MY_SQL_SERVER
net stop MSSQL$MY_SQL_SERVER
echo 关闭sqlServer服务完成
echo.&pause
goto doit
需要注意的地方:把Oracle和SqlServer各服务的名称换成自己机器上的服务名即可。