pf » Batch Files to Restart Services on Windows
October 09, 2002
Batch Files to Restart Services on Windows
I wrote some batch files today for restarting services on windows. The bat files can be used to restart ColdFusion MX or IIS services on Windows NT/2000/XP.
Batch File to restart ColdFusion MX
@echo off REM - File: cfmxrestart.bat REM - Description: Restart's ColdFusion MX Services REM - Author: Pete Freitag echo Restarting ColdFusion MX... echo ====================================================== net stop "ColdFusion MX Application Server" net stop "ColdFusion MX ODBC Agent" net stop "ColdFusion MX ODBC Server" net start "ColdFusion MX Application Server" net start "ColdFusion MX ODBC Agent" net start "ColdFusion MX ODBC Server" echo ====================================================== echo ColdFusion MX Restarted
Batch file to restart IIS
@echo off REM - File: iisrestart.bat REM - Description: Restart's IIS (Web, FTP, SMTP) REM - Author: Pete Freitag REM - ADD REM comments if you don't want to restart any REM - of Services echo Restarting IIS... echo ====================================================== net stop "World Wide Web Publishing Service" net start "World Wide Web Publishing Service" net stop "FTP Publishing Service" net start "FTP Publishing Service" net stop "Simple Mail Transport Protocol (SMTP)" net start "Simple Mail Transport Protocol (SMTP)" echo ====================================================== echo IIS RestartedBat files are handy because you can restart multiple services with one command. You can either double click the bat file to run it, schedule it, or throw it in c:\windows\system32 and then run it from anywhere in the command prompt or (Start->Run)
Related Entries
- Howto Disable the Server Header in IIS - December 6, 2005
- Cheat Sheet Roundup - Over 30 Cheatsheets for developers - September 1, 2005
- Apache mod_rewrite for IIS - March 24, 2005
Trackback Address: 87/4EB786F8293CEA1417A5EB32BDD7BD87
Comments
On 01/14/2004 at 1:12:11 PM MST ging wrote:
1
Anybody can help me to write a bat file to backup some data from c:\program files\winair to Home directory H:\user name. I knew a little bit but not so good. Please give me some detailed information.
On 03/29/2004 at 8:19:26 PM MST Kirk Mower wrote:
2
I know it is not safest thing to do, but is there a simple way to execute a batch file from a web page ? I want to do this for some other APIs that crash occasionally. Thanks.
On 12/16/2004 at 9:25:34 AM MST Jason FAWcett wrote:
3
I cannot run any of my programs because I have lost my MICROSETUPLIB.BAT file can you help please e-mail me ! Thanks Jason
On 06/22/2007 at 11:24:09 AM MDT SREE wrote:
4
while i run your iis restaTHE Specified service does not exit as an installed service.
On 10/25/2007 at 8:17:55 AM MDT Sander wrote:
5
Why don't you check if what you post actually works before putting it online? The MS knowledgebase specifically states that: "NOTE: For each service, there is also a DisplayName value, which is the name listed in the Services applet in Control Panel and in the messages displayed after the NET STOP and NET START commands are run. However, these Display Names cannot be used as a parameter with the NET STOP and NET START commands." http://support.microsoft.com/kb/236166
Please chekc your facts before posting such nonsense.
On 04/02/2008 at 3:24:15 PM MST DallasPartners.com wrote:
6
@echo off REM - File: iisrestart.bat REM - Description: Restart's IIS (Web, FTP, SMTP) REM - Author: Pete Freitag REM - ADD REM comments if you don't want to restart any REM - of Services echo Restarting IIS... echo ======================================================
net stop W3SVC net start W3SVC
echo ====================================================== echo IIS Restarted
REM - File: iisrestart.bat REM - Description: Restart's IIS (Web, FTP, SMTP) REM - Author: Pete Freitag REM - ADD REM comments if you don't want to restart any REM - of Services echo Restarting SQL... echo ======================================================
net stop "SQL Server Agent (MSSQLSERVER)" net stop MSSQLSERVER net start MSSQLSERVER net start "SQL Server Agent (MSSQLSERVER)"
echo ====================================================== echo SQL Restarted
- CFSCRIPT Cheatsheet
- 3 New Image Effects for ColdFusion 8
- Googlebot to Submit Web Forms
- ColdFusion 8 Update 1 Fixes some Image Processing Quirks
- 10 Most Useful Image Functions in ColdFusion 8
- Speaking at NYC CFUG This Week
- Adobe AIR Tutorial for HTML / JavaScript Developers
- INFORMATION_SCHEMA Support in MySQL, PostgreSQL
Subscribe to my RSS Feed:
RSS
RSS
add to del.icio.us
Pete Freitag is a software engineer, and web developer located in










