文中的虚拟网卡禁用功能,使用了微软DevCon 设备控制工具,下载地址:http://support.microsoft.com/kb/311272/zh-cn
解压相应操作系统的.EXE文件,至批处理文件同目录下即可。
功能:
禁用/启用 虚拟机相关服务
关闭/启动 虚拟机相关服务
关闭/启动 虚拟机相关程序
禁用/启用 虚拟网卡
@echo off
color 27
echo --------------------------------------------------------
echo ----------------------VMware小助手----------------------
echo -------------------------------------------by Issay-----
echo --------------------------------------------------------
echo ------------输入"r"开启虚拟机服务-----------------★★★
echo ------------输入"s"关闭虚拟机服务-----------------★★★
echo --------------------------------------------------★★★
SET /P choice=请选择操作项:
if /i '%choice:~0,1%'=='r' goto start
if /i '%choice:~0,1%'=='s' goto stop
exit
:start
echo -----------------------------------------------------------
echo 正在安装虚拟机相关服务
sc config VMAuthdService start= auto
sc config VMnetDHCP start= auto
sc config "VMware NAT Service" start= auto
echo ...
echo finished!
echo -----------------------------------------------------------
echo 正在启动虚拟机相关服务
echo ...
net start VMAuthdService
net start VMnetDHCP
net start "VMware NAT Service"
echo ...
echo finished!
echo -----------------------------------------------------------
echo 正在启动虚拟机相关程序
echo ...
start "D:\VMware Workstation\vmnat.exe"
start "D:\VMware Workstation\VMnetDHCP.exe"
start "D:\VMware Workstation\vmware-authd.exe"
echo ...
echo finished!
echo -----------------------------------------------------------
echo 正在启用虚拟网络
echo ...
devcon.exe enable *vmnetadapter1
devcon.exe enable *vmnetadapter8
echo ...
echo finished!
echo -----------------------------------------------------------
echo ---------虚拟机准备完毕,请启动程序-----------
echo -------------------请按任意键退出-------------------
echo -----------------------------------------------------------
pause
exit
:stop
echo -----------------------------------------------------------
echo 正在结束虚拟机相关程序
echo ...
taskkill /f /t /im vmnat.exe
taskkill /f /t /im vmnetdhcp.exe
taskkill /f /t /im vmware-authd.exe
echo ...
echo finished!
echo -----------------------------------------------------------
echo 正在关闭虚拟机相关服务
echo ...
net stop VMAuthdService
echo ...
echo finished!
echo -----------------------------------------------------------
echo 正在卸载虚拟机相关服务
echo...
sc config VMAuthdService start= disabled
sc config VMnetDHCP start= disabled
sc config "VMware NAT Service" start= disabled
echo ...
echo finished!
echo -----------------------------------------------------------
echo 正在禁用虚拟网络
echo ...
devcon.exe disable *vmnetadapter1
devcon.exe disable *vmnetadapter8
echo ...
echo finished!
echo -----------------------------------------------------------
echo --------WMware优化完毕!---------
echo -------------------请按任意键退出-------------------
echo -----------------------------------------------------------
pause
exit