If you are a stack developer who works on multiple platform for coding, might face this proble of starting and stoping the Sql Server, because if you want work in default port 80 for apache in php of any other, you have to stop the iis and SQL server to run apache in port 80 only, so while doing this to start/stop we use eather SQL Configuration manager/ windows services. so here we will tell you how to create a .bat file to start and stop all the sql services at once.
Follow the Steps below
- first, create a new file in notpad and save as start.bat file the just copy this below code to the same start.bat file and save.
- After saving first file create one more file called stop.bat using notepadand paste the below code.
- After completing creation of new files now when ever you need these file you have to right click on .bat file and run this file in Administrator mode by clicking on “Run as Administrator”.
Note : in the above code i have used our SQL running server name “MSSQLSERVER”, this might be different in your PC. To check goto Run and type Services.msc in that file list of SQL services the you can find the SQL Instance name as shown in below image.