Manually Restart Apache and MYSQL thru .bat file

bat-file-icon
Please save the below code as .bat file through notepad or any other editor.

@echo off
cls
:start
Echo.
Echo 1. Restart Apache
Echo 2. Restart MYSQL
Echo 3. Both
Echo 4. Exit
set /p choice=Please enter your choice:
rem if not '%choice%' == '' ser choice=%choice:~0;1%
if '%choice%' == '' Echo "%choice%" is not valid please try again
if '%choice%' == '1' goto apache
if '%choice%' == '2' goto mysql
if '%choice%' == '3' goto both
if '%choice%' == '4' goto exit
Echo.
goto start
:apache
Echo Apache
net stop Apache2.4 && net start Apache2.4
goto end
:mysql
Echo Mysql
net stop mysql && net start mysql
goto end
:both
Echo Both
net stop Apache2.4 && net start Apache2.4
net stop mysql && net start mysql
goto end
:exit
goto end
:end
pause
exit

Now just double click that .bat file and you can restart Apache/MYSQL or both.

NOTE: Please replace “Apache2.4” with your apache version.

Extras: Addicted Upcoming

Advertisements