为了运行Linux,又兼顾办公,我在安装Win10的笔记本安装了VMware Workstation,但这家伙让电脑CPU风扇狂转,但有时只是办公,并不用虚拟机,这时VMware Workstation驻留的服务进程一直在耗用资源,导致电脑卡顿,能不能根据自己需求,手动对VMware Workstation的服务进行启停呢?于是根据网络资料整理了如下脚本VmSwitch.bat,亲测好用。
rem *******************************************************************************************
rem * Switch for VMware services (Version2.0) *
rem * *
rem * Author: 左国才 *
rem * *
rem * Email: zuoguocai@126.com *
rem * *
rem * LastChange: 2017-03-05 *
rem * *
rem * *
rem * 共5个服务,VMware Workstation Server 这个服务用于虚拟机分享,一般用不到, 用到的时候再 *
rem * 手动开启即可. 本程序只会启动和关闭4个服务. *
rem * 修改背景颜色,通过color /? 获取cmd中所有支持的颜色. *
rem * 需要以管理员身份运行. *
rem *******************************************************************************************
@echo off
title VMware开关程序
mode con cols=60 lines=30
color 2F
call :checkAdmin
GOTO MENU
:MENU
echo.=========VMware 手工启动批处理=========
echo=
echo. 1 启动VMware各项服务
echo=
echo. 2 关闭VMware各项服务
echo=
echo. 3 exit
echo=
echo.=======================================
echo.请选择:
set /p ID=
if "%id%"=="1" goto start
if "%id%"=="2" goto stop
if "%id%"=="3" exit
PAUSE
:start
net start "VMware USB Arbitration Service"
net start "VMware Authorization Service"
net start "VMware NAT Service"
net start "VMware DHCP Service"
rem ===关闭防火墙===
netsh advfirewall set publicprofile state off
goto MENU
:stop
rem net stop "VMware Registration Service"
net stop "VMware USB Arbitration Service"
net stop "VMware Authorization Service"
net stop "VMware NAT Service"
net stop "VMware DHCP Service"
rem net stop "VMware Virtual Mount Manager Extended"
goto MENU
:checkAdmin
echo test am i admin? > %SystemRoot%\System32\test.zuo
if not exist %SystemRoot%\System32\test.zuo (
echo " ( ⊙ o ⊙ ) 请右键以管理员身份运行! "
pause
exit
)
del %SystemRoot%\System32\test.zuo