当前位置:首页 > 开发 > 操作系统 > 正文

bat 脚本启动windows服务

发表于: 2014-08-26   作者:丁树同   来源:转载   浏览:
bat
摘要: @echo off title stop/start windows service :allStart cls echo [1] MySQL echo [2] Apache echo [3] Windows Update echo [4] Oracle echo [5] VMWare echo [e] exit set in= set /p in=please enter
@echo off
title stop/start windows service
:allStart
cls
echo [1]	MySQL
echo [2]	Apache
echo [3]	Windows Update
echo [4]	Oracle
echo [5]	VMWare
echo [e]	exit
set in=
set /p in=please enter the num:

if "%in%"=="1" goto mysql
if "%in%"=="2" goto apache
if "%in%"=="3" goto windowsUpdate
if "%in%"=="4" goto Oracle
if "%in%"=="5" goto Vmware
if "%in%"=="e" goto allClose

:mysql
cls
echo [1]	start mysql service
echo [2]	stop mysql service
echo [b]	go back
echo [e]	exit
set in=
set /p in=	please enter the num:
if "%in%"=="1" goto mysqlStart
if "%in%"=="2" goto mysqlStop
if "%in%"=="b" goto allStart
if "%in%"=="e" goto allClose

:apache
cls
echo [1]	start apache service
echo [2]	stop apache service
echo [b]	go back
echo [e]	exit
set in=
set /p in=	please enter the num:
if "%in%"=="1" goto apacheStart
if "%in%"=="2" goto apacheStop
if "%in%"=="b" goto allStart
if "%in%"=="e" goto allClose

:windowsUpdate
cls
echo [1]	start windows update service
echo [2]	stop windows update service
echo [b]	go back
echo [e]	exit
set in=
set /p in=	please enter the num:
if "%in%"=="1" goto windowsUpdateStart
if "%in%"=="2" goto windowsUpdateStop
if "%in%"=="b" goto allStart
if "%in%"=="e" goto allClose

:Oracle
cls
echo [1]	start oralce service
echo [2]	stop oracle service
echo [b]	go back
echo [e]	exit
set in=
set /p in=	please enter the num:
if "%in%"=="1" goto oracleStart
if "%in%"=="2" goto oracleStop
if "%in%"=="b" goto allStart
if "%in%"=="e" goto allClose

:Vmware
cls
echo [1]	start VMware service
echo [2]	stop VMware service
echo [b]	go back
echo [e]	exit
set in=
set /p in=	please enter the num:
if "%in%"=="1" goto VmwareStart
if "%in%"=="2" goto VmwareStop
if "%in%"=="b" goto allStart
if "%in%"=="e" goto allClose

:mysqlStart
net start MySQL
goto allStart
:mysqlStop
net stop MySQL
goto allStart

:apacheStart
net start Apache2.2
goto allStart
:apacheStop
net stop Apache2.2
goto allStart

:windowsUpdateStart
net start wuauserv
goto allStart
:windowsUpdateStop
net stop wuauserv
goto allStart

:oracleStart
net start OracleOraDb11g_home1TNSListener
net start OracleServiceORCL
net start OracleDBConsoleorcl
goto allStart
:oracleStop
net stop OracleOraDb11g_home1TNSListener
net stop OracleServiceORCL
net stop OracleDBConsoleorcl
goto allStart

:VmwareStart
net start VMAuthdService
net start VMnetDHCP
net start "VMware NAT Service"
net start VMUSBArbService
net start VMwareHostd

goto allStart
:VmwareStop
net stop VMAuthdService
net stop VMnetDHCP
net stop "VMware NAT Service"
net stop VMUSBArbService
net stop VMwareHostd
goto allStart

:allClose
echo please enter any key to exit
pause
exit

rem ## how to delete the service in the windows?
rem ## sc delete [service name]
rem ## windows+R --> cmd --> services.msc


 

bat 脚本启动windows服务

  • 0

    开心

    开心

  • 0

    板砖

    板砖

  • 0

    感动

    感动

  • 0

    有用

    有用

  • 0

    疑问

    疑问

  • 0

    难过

    难过

  • 0

    无聊

    无聊

  • 0

    震惊

    震惊

版权所有 IT知识库 CopyRight © 2009-2015 IT知识库 IT610.com , All Rights Reserved. 京ICP备09083238号