通过批处理启动和停止MSSQL+IIS

电脑安装了不少的开发工具环境,如MSSQL2005(2000)+IIS\MySQL+Apache等等,开机和娱乐时为了加快速度,都得把这些占用内存的开发工具系统服务停止,每项手工操作明显麻烦,用批处理就简单多了... 点一下启动,再点一下关闭 --- 方便!

@echo off 
sc query |find /i "SQL Server" >nul 2>nul
::判断服务是否启动 2000服务:mssqlserver
if not errorlevel 1 (goto endserver) else goto beginserver 

:beginserver 
@echo.启动 MSSQL2005 服务......
net start "SQL Server (MSSQL2005)"
::net start "SQL Server Analysis Services (MSSQL2005)"
net start "SQL Server FullText Search (MSSQL2005)"
::net start "SQL Server Integration Services"
net start "SQL Server Browser"
net start "SQL Server Agent (MSSQL2005)"
echo.启动IIS服务...
sc config IISADMIN start= auto
sc config W3SVC start= auto
sc config HTTPFilter start= auto
net start W3SVC
net start HTTPFilter
net start IISADMIN
goto end1 
:endserver 
@echo.停止 MSSQL2005 服务......
net stop "SQL Server (MSSQL2005)" /y
::net stop "SQL Server Analysis Services (MSSQL2005)"
net stop "SQL Server FullText Search (MSSQL2005)" /y
::net stop "SQL Server Integration Services"
net stop "SQL Server Browser" /y
net stop "SQL Server Agent (MSSQL2005)" /y
echo.停止IIS服务...
sc config IISADMIN start= disabled
sc config W3SVC start= disabled
sc config HTTPFilter start= disabled
net stop W3SVC
net stop HTTPFilter
net stop IISADMIN
goto end2 
:end1 
@echo off
@echo ************************************************ 
@echo ***IIS+MSSQL启动成功!要重新打开此文件才能再次使用命令* 
@echo ************************************************ 
@pause >nul
exit
:end2 
@echo off
@echo ************************************************ 
@echo ***IIS+MSSQL停止成功!要重新打开此文件才能再次使用命令* 
@echo ************************************************ 
@pauseexit 

你可能感兴趣的:(批处理)