[小技巧]虚拟机服务管理小程序

每次开启虚拟机的时候,都需要启动一堆服务,

如果把这些服务设置为自动吧,没用虚拟机的时候,又觉得在浪费~~

于是有了下面这个小工具,将下面的代码复制保存成“XXX.bat”,双击执行即可。

echo off
title VMService Manager - %date% %time% 
:A
color A
cls
echo                   ++++++++++++++++++++++++++++++++++++++++++++++++
echo                   =          WELCOME  TO  VMServices Manager     =
echo.                  =                                              =
echo                   =    Start= 1  Stop= 2  SetDemand= 3  Exit= 4  =
echo.                  =                                              =
echo.                  =                                              =
echo                   ++++++++++++++++++++++++++++++++++++++++++++++++
echo.
echo.
set session=""
set /p session= Select[1/2/3/4]:
if /i "%session%"=="1" (goto:1)
if /i "%session%"=="2" (goto:2)
if /i "%session%"=="3" (goto:3)
if /i "%session%"=="4" (goto:4)

:1
echo "Starting VMware Services..."
net start VMAuthdService
net start VMnetDHCP
net start "VMware NAT Service"
net start VMUSBArbService
echo Start success!
ping 127.0.0.1 /n 2 >nul
goto:A

:2
echo "Stopping VMware Services..."
net stop VMAuthdService
net stop VMnetDHCP
net stop "VMware NAT Service"
net stop VMUSBArbService
echo Stop success!
ping 127.0.0.1 /n 2 >nul
goto:A

:3
echo Change VMware Services status into demand.Please wait...
%auto    demand    disabled%
sc config VMAuthdService start= demand
sc config VMnetDHCP start= demand
sc config "VMware NAT Service" start= demand
sc config VMUSBArbService start= demand
echo Change success!
ping 127.0.0.1 /n 2 >nul
goto:A

:4
cls
echo Bye...
ping 127.0.0.1 /n 2 >nul
exit

说明:

  • 1:启动虚拟机相关服务
  • 2:停止虚拟机相关服务
  • 3:将服务设置为手动
  • 4:退出

 

 

 

posted @ 2013-05-30 11:33  yejg1212  阅读(453)  评论(0编辑  收藏  举报