概述
需求:随着安装软件越来越多,计算机后台自启动服务数量也越来越庞大。但是有些服务并不一定需要实时运行。
背景:需要将系统非必需的服务设置为 手动 启动。
<span style="font-family:Verdana;">@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</span>
最后
以上就是个性月亮为你收集整理的bat脚本 手动启动系统服务的全部内容,希望文章能够帮你解决bat脚本 手动启动系统服务所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复