So, I’ve got both Apache 2 and IIS 5.1 installed on my laptop and need both web server environments for testing purposes and was trying to find a quick-n-dirty way to start and stop both services without having to drill through shortcuts and clicking on this or that. I just wanted to run a quick .bat file that’d handle it all for me quick and easy.
With a little digging and researching on starting and stopping services, I put together two .bat files, one to start IIS and stop Apache, and the other to do the opposite, stop IIS and start Apache.
Anyway, here’s what you need to do to perform this quick-n-dirty operation. Open up a text editor and prepare to copy-n-paste-n-save.
The file to start IIS and stop Apache2:
NET STOP "Apache2"
NET START "World Wide Web Publishing"
Paste that in your editor and name it something like startIIS.bat and save it someplace accessible like your desktop or your start menu.
The file to stop IIS and start Apache2:
NET STOP "World Wide Web Publishing"
NET START "Apache2"
do the same as the first file, but name it something like stopIIS.bat.
Now here’s the catch on this though, the words in “quotations” are the actual name of the service as found in your list of services running in Windows 2000/XP. The name will vary from OS to OS. It may be “Personal Web Server”, “World Wide Web Publishing”, “Apache”, “IIS” or some othe name similar to that. Whatever the case may be, make sure you’re referencing the exact service name (you’ll find that under the “Name” field).
Hope that helps you out like it did me. It proves useful for working with two server environments on one machine—now it’s easy for me to do testing and development within the ASP.NET framework as well as switching over to a more “*nix-like” environment with Apache running PHP/MySQL.
September 13, 2005, 7:12 pm