SQL Server停止指令碼

luckyfriends發表於2015-04-07
@echo off
set LOG_FILE=%cd%\setup.log


echo "----------Begin to stop SQL Server service-----------" >> %LOG_FILE%


net stop MSSQLSERVER


net start | find "SQL Server (MSSQLSERVER)"
set EXIT_CODE=%errorlevel%
if %EXIT_CODE% == 1 (
echo "-----------Stop SQL Service successfully----------" >> %LOG_FILE%
set EXIT_CODE=0
goto END
)


echo "Stop MSSQLSERVER failed." >> %LOG_FILE%


:END
exit %EXIT_CODE%

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/14710393/viewspace-1518430/,如需轉載,請註明出處,否則將追究法律責任。

相關文章