Web design, SQL, and .NET for the young, up-and-coming developer Dot Net Yuppie

I use the same machine to do development and to do all of my web surfing/school work/e-mails. Often times I don’t want MSSQL server and IIS running when I’m not working because it wastes resources and slows down my computer.

Customize your environment
Windows makes it simple to customize your environment so services like IIS, MSSQL, WebClient, etc. can be started and stopped just by running a small BAT file. To create your own development environment BAT file:

  1. Open Notepad
  2. Copy and paste the following text into notepad:
    
    	@echo off
    
    	:start
    	set /p _input="Server? [y/n]"
    
    	if %_input% equ y (
    		echo Starting server services…
    		sc start HTTPFilter 	REM HTTP SSL
    		sc start IISADMIN		REM IIS Admin
    		sc start lanmanserver	REM Server
    		sc start MSSQLSERVER	REM SQL Server
    		sc start SQLBrowser		REM SQL Server Browser
    		sc start SQLWriter		REM SQL Server VSS Writer
    		sc start W3SVC			REM World Wide Web Publishing
    		sc start WebClient		REM WebClient
    
    		set /p ="Hit any key to continue…"
    	) else (
    		echo STOPPING server services…
    		sc stop HTTPFilter
    		sc stop IISADMIN
    		sc stop lanmanserver
    		sc stop MSSQLSERVER
    		sc stop SQLBrowser
    		sc stop SQLWriter
    		sc stop W3SVC
    		sc stop WebClient
    
    		set /p ="Hit any key to continue…"
    	)
    
    	:end
    
  3. Save the file as Server.bat onto your desktop — you can name it whatever you like, as long as you have the file extension ‘.bat’
  4. Double click the BAT file on your desktop — a command window will open, and prompt you with “Server? [y/n]“. If you want to enable your development environment, hit ‘y’ — if you want to disable your development environment, hit ‘n’

This script is utilizing “sc stop” and “sc start”, which are both commands to start and stop different services. Depending on your machine, your services may be different than mine. I encourage you to customize the BAT file to start/stop whichever services you find pertinent to your development environment. Unfortunately, some services (like MDM) don’t respond to ’sc stop’ — but this script is able to toggle some of the more important, resource-loving services.

You’ll find that by using this script, you can toggle between a development environment and a ‘fun’ environment within seconds. If you’re on a desktop machine that you also play games on, a script like this is invaluable to speed up your machine when you’re gaming, but still allow you to easily switch back to a development mode.

Leave a Reply