vs开关sql服务

用C#制作一个开关sql服务的winform程序。。。。

慕村9548890
浏览 443回答 1
1回答

杨__羊羊

自己写的一个bat。查c#执行批处理的方法。@echo offcolor 0B::判断服务是否被禁用,如果被禁用就设置为自动...::wmic service where "name="MSSQL$ASTAR7" and startmode="disabled"" call changestartmode::判断服务是否启动,如果未启动就启动此服务...::wmic service where "name="MSSQL$ASTAR7" and state="stopped"" call startservicenet start >d:\service.txtfind /i d:\service.txt "SQL Server (ASTAR7)"if errorlevel 1 goto startif errorlevel 0 goto stop:startnet start MSSQL$ASTAR7goto success:stopnet stop MSSQL$ASTAR7goto end:success::net start@echo 服务开启成功...:enddel "d:\service.txt"
打开App,查看更多内容
随时随地看视频慕课网APP