作为开发人员,一个电脑安装个IIS、MSSQL、MYSQL....,我们的电脑不是服务器,每次开机都自动启动,耗费了不少的资源,其实只在调试的时候需要启动下,别的基本不用开机启动。
写了个bat批处理来简单处理这些问题,使用它能让电脑快一个级别~
复制下面代码到.txt文档,修改后缀名为.bat就可以了,good luck!
echo off
title Switch %date% %time% QQ:365130596
sc config MSSQLSERVER start= DEMAND
sc config W3SVC start= DEMAND
cls
echo.
echo 已经将IIS与MSSQL改成手动模式
echo.
ping 127.0.0.1 /n 2 >nul
:start
color A
cls
echo ++++++++++++++++++++++++++++++++++++++++++++++++
echo = WELCOME TO SWITCH =
echo. = =
echo = MSSQL= S MYSQL= Y IIS= I EXIT=X =
echo. = =
echo = ( ON=1 OFF=0 ) =
echo. = =
echo ++++++++++++++++++++++++++++++++++++++++++++++++
echo.
echo.
set session=""
set /p session= Input[s/y/i/x]:
if /i "%session%"=="s" (goto:mssql)
if /i "%session%"=="y" (goto:mysql)
if /i "%session%"=="i" (goto:iis)
if /i "%session%"=="x" (echo.&echo 任意键退出...&pause >nul&exit)
goto:start
:mssql
set order=""
echo.
set /p order= MSSQL [0/1]:
if /i "%order%"=="1" (net start MSSQLSERVER 2>nul)
if /i "%order%"=="0" (net stop MSSQLSERVER 2>nul)
if exist "error.txt" (type "error.txt" & del "error.txt")
echo.
echo.
echo 任意键返回主菜单
pause >nul
goto:start
:mysql
set order=""
goto:start
:iis
set order=""
echo.
set /p order= IIS [0/1]:
if /i "%order%"=="1" (net start W3SVC 2>nul)
if /i "%order%"=="0" (net start W3SVC 2>nul)
echo.
echo.
echo 任意键返回主菜单
pause >nul
goto:start