bat控制程序后台

本帖最后由 不浮不躁 于 2019-8-18 13:52 编辑

很多软件已安装就有进程服务常驻后台,有些无法禁用,然而手动太过麻烦。
然后就可以用bat来进行控制:通过bat启动程序,程序关闭自动处理后天,这样如VMware类软件可以改手动启动,需要bat启动免除后台常驻。
举例:VMware相关进程改手动启动:
[Asm] 纯文本查看 复制代码

%1 start "" mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",0)(window.close)&&exit

echo "开始启动网卡和服务"
netsh interface set interface "VMware Network Adapter VMnet1" enabled
netsh interface set interface "VMware Network Adapter VMnet8" enabled
net start "VMAuthdService"
net start "VMware NAT Service"
net start "VMnetDHCP"
net start "VMUSBArbService"
net start "VMware Workstation Server"

echo "程序启动后不要关闭本窗口"
c:
cd "C:\Program Files (x86)\VMware\VMware Workstation"
::"C:\Program Files (x86)\VMware\VMwareWorkstation\vmware.exe"
::start vmware-tray.exe
vmware.exe

echo "开始关闭启动网卡和服务"
taskkill /f /t /im vmware-tray.exe
netsh interface set interface "VMware Network Adapter VMnet1" disabled
netsh interface set interface "VMware Network Adapter VMnet8" disabled
net stop "VMware Workstation Server"
net stop "VMAuthdService"
net stop "VMUSBArbService"
net stop "VMnetDHCP"
net stop "VMware NAT Service"

注:bat可放程序目录然后桌面快捷方式,可右键属性修改图标。

如有更好方式,请分享交流。谢谢!!!

THE END
喜欢就支持以下吧
点赞0
分享
评论 抢沙发
管埋员的头像-小北的自留地

昵称

取消
昵称