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)
Tweet
Related Entries
- ColdFusion Lockdown Series - Multiple Partitions - April 21, 2011
- Changing the ColdFusion CFIDE Scripts Location - January 10, 2011
- Is your ColdFusion Administrator Actually Public? - April 28, 2010
- ColdFusion 9 Performance Brief from Adobe - February 24, 2010
- Request Filtering in IIS 7 Howto - February 16, 2010
Trackbacks
Comments
Please chekc your facts before posting such nonsense.
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
please help me Kish
@ECHO off title Shutdown process for ColdFusion 8 and Internet Services.
:restart c: cd\ cls
ECHO. ECHO ========================================== ECHO. ECHO Shutdown process for ColdFusion 8. ECHO Written by: Scott Sandbakken. ECHO. ECHO Use at your own risk. ECHO No warrenty expressed or implied. ECHO. ECHO ========================================== ECHO.
:start
set gohere == 'start'
ECHO. ECHO 1. Shut down Internet Services ECHO 2. Start Internet Services ECHO 3. Restart Internet Services ECHO X. Exit ECHO.
set choice= set /p choice=Please make a selection:
if not '%choice%'==' set choice=%choice:~0,1% if '%choice%'=='1' goto one if '%choice%'=='2' goto two if '%choice%'=='3' goto three if '%choice%'=='q' goto quit if '%choice%'=='Q' goto quit if '%choice%'=='x' goto exit if '%choice%'=='X' goto exit
ECHO "%choice%" is not valid please try again ECHO.
goto start
:one
ECHO. ECHO Stopping ColdFusion 8 Services ECHO.
NET STOP "ColdFusion 8 .NET Service" NET STOP "ColdFusion 8 ODBC Agent" NET STOP "ColdFusion 8 ODBC Server" NET STOP "ColdFusion 8 Search Server" NET STOP "ColdFusion 8 Application Server"
ECHO. ECHO Stopping Internet Services ECHO.
NET STOP "Simple Mail Transfer Protocol (SMTP)" NET STOP "World Wide Web Publishing" NET STOP "IIS Admin"
ECHO. ECHO \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ECHO ColdFusion 8 and Internet Services have been shut down. ECHO //////////////////////////////////// ECHO.
goto start
:two
ECHO. ECHO Starting Internet services ECHO.
NET START "IIS Admin" NET START "Simple Mail Transfer Protocol (SMTP)" NET START "World Wide Web Publishing"
ECHO. ECHO Starting ColdFusion 8 Services ECHO.
NET START "ColdFusion 8 Application Server" NET START "ColdFusion 8 .NET Service" NET START "ColdFusion 8 ODBC Server" NET START "ColdFusion 8 ODBC Agent" NET START "ColdFusion 8 Search Server"
ECHO. ECHO \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ECHO ColdFusion 8 and Internet Services have been started. ECHO //////////////////////////////////// ECHO.
goto start
:three
ECHO. ECHO Stopping ColdFusion 8 and Internet Services ECHO.
NET STOP "ColdFusion 8 .NET Service" NET STOP "ColdFusion 8 ODBC Agent" NET STOP "ColdFusion 8 ODBC Server" NET STOP "ColdFusion 8 Search Server" NET STOP "ColdFusion 8 Application Server"
NET STOP "Simple Mail Transfer Protocol (SMTP)" NET STOP "World Wide Web Publishing" NET STOP "IIS Admin"
ECHO. ECHO Starting ColdFusion 8 and Internet Services ECHO.
NET START "IIS Admin" NET START "Simple Mail Transfer Protocol (SMTP)" NET START "World Wide Web Publishing"
NET START "ColdFusion 8 Application Server" NET START "ColdFusion 8 .NET Service" NET START "ColdFusion 8 ODBC Server" NET START "ColdFusion 8 ODBC Agent" NET START "ColdFusion 8 Search Server"
ECHO. ECHO \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ECHO ColdFusion 8 and Internet Services have been restarted. ECHO //////////////////////////////////// ECHO.
goto start
:exit exit
:quit cls cmd goto restart
How can I use it to restart services on a remote computer?
How can I use it to restart services on a remote computer?
start google.be ffs lazy..
ps wampmysqld is installed with wamp
You really just need to substitute in the service name from Services, for instance "ColdFusion 9 Application Server"
For CF8 I use this:
@echo off echo Restarting ColdFusion 8... echo ====================================================== net stop "ColdFusion 8 Application Server" choice /T 20 /D y net start "ColdFusion 8 Application Server" echo ====================================================== echo ColdFusion 8 Restarted
@echo off echo Restarting ColdFusion 8... echo ====================================================== net stop "ColdFusion 8 Application Server" choice /T 20 /D y net start "ColdFusion 8 Application Server" echo ====================================================== echo ColdFusion 8 Restarted
(if this fails to post properly, i think you can figure out where the breaks go)
Post a Comment
Recent Entries
- Firefox Aurora now Supports Content Security Policy 1.0
- Writing Secure CFML cfObjective 2013 Slides
- Upgrading to Java 7 on Linux
- J2EE Sessions in CF10 Uses Secure Cookies
- Learn about ColdFusion Security at cfObjective 2013
- Session Loss and Session Fixation in ColdFusion
- FuseGuard 2.3 Released
- CKEditor Spell Checker Plugin


add to del.icio.us



