12
返回列表 发新帖
楼主: xinzhiyu
收起左侧

[分享] 批命令关闭vmware

[复制链接]
power562
发表于 2011-12-2 22:15:38 | 显示全部楼层
tasklist | findstr /i "vmware-tray.exe" > nul &&  taskkill /f /t /im “vmware-tray.exe”
可以加个判断,若vmware-tray.exe进程存在,则 kill 掉
power562
发表于 2011-12-2 22:56:10 | 显示全部楼层
我把我的批处理分享一下,适用于VM7.0以上版本。把下边的内容复制进txt文档中,然后把txt后缀改成bat就OK了。如果是win7用户,执行的时候在bat文件上按右键,选择“以管理员身份运行”,否则会执行失败。

@echo off
color 1a

:main
cls
echo.
echo 1  启动VMware服务
echo.
echo 2  停止VMware服务
echo.
echo 0  直接退出
echo.
set /p num=请输入(1/2/0)然后回车:
if /i '%num%'=='1' GOTO start
if /i '%num%'=='2' GOTO stop
if /i '%num%'=='0' exit
cls
echo 输入错误:请重新输入
echo.
pause
GOTO main

:start
cls&&echo 正在启动VMware服务,请稍候...
echo.
(net start | find /i "VMware Authorization Service" > nul && echo "VMware Authorization Service 服务已经启动") || net start VMAuthdService
(net start | find /i "VMware DHCP Service" > nul && echo "VMware DHCP Service 服务已经启动") || net start VMnetDHCP
(net start | find /i "VMware NAT Service" > nul && echo "VMware NAT Service 服务已经启动") || net start "VMware NAT Service"
(net start | find /i "VMware USB Arbitration Service" > nul && echo "VMware USB Arbitration Service 服务已经启动") || net start VMUSBArbService
REM (net start | find /i "VMware Workstation Server" > nul && echo "VMware Workstation Server 服务已经启动") || net start VMwareHostd
echo.
GOTO lo

:stop
cls&&echo 正在停止VMware服务,请稍候...
echo.
(tasklist | findstr /i "vmware-tray.exe" > nul && taskkill /f /t /im "vmware-tray.exe") || echo "vmware-tray.exe 进程不存在"
(net start | find /i "VMware DHCP Service" > nul && net stop VMnetDHCP) || echo "VMware DHCP Service 服务已经停止"
(net start | find /i "VMware NAT Service" > nul && net stop "VMware NAT Service") || echo "VMware NAT Service 服务已经停止"
(net start | find /i "VMware USB Arbitration Service" > nul && net stop VMUSBArbService) || echo "VMware USB Arbitration Service 服务已经停止"
REM (net start | find /i "VMware Workstation Server" > nul && net stop VMwareHostd) || echo "VMware Workstation Server 服务已经停止"
(net start | find /i "VMware Authorization Service" > nul && net stop VMAuthdService) || echo "VMware Authorization Service 服务已经停止"
echo.
GOTO lo

:lo
echo.
SET /p yn=是否返回继续操作 : [y/n]
IF %yn% == y GOTO main
exit
您需要登录后才可以回帖 登录 | 快速注册

本版积分规则

手机版|杀毒软件|软件论坛| 卡饭论坛

Copyright © KaFan  KaFan.cn All Rights Reserved.

Powered by Discuz! X3.4( 沪ICP备2020031077号-2 ) GMT+8, 2024-11-24 15:26 , Processed in 0.099088 second(s), 13 queries .

卡饭网所发布的一切软件、样本、工具、文章等仅限用于学习和研究,不得将上述内容用于商业或者其他非法用途,否则产生的一切后果自负,本站信息来自网络,版权争议问题与本站无关,您必须在下载后的24小时之内从您的电脑中彻底删除上述信息,如有问题请通过邮件与我们联系。

快速回复 客服 返回顶部 返回列表