Vmware 实现自动开机启动指定虚拟机,新建文件:123.bat
"C:\Program Files (x86)\VMware\VMware Workstation\vmware.exe" -x "E:\Windows 7\Windows 7.vmx"
REM "C:\Program Files (x86)\VMware\VMware Workstation\vmware.exe" #vm安装路径
REM "E:\Windows 7\Windows 7.vmx" #需要启动的虚拟机
打开 gpedit.msc把 123.bat 放到登录中, 注意,这里是用户配置.
![](https://www.sanradar.com/wp-content/uploads/2023/11/1700279413686.png)
系统关闭自动关闭虚拟机,新建234.bat
@echo off
echo 正在关闭虚拟机…
"C:\Program Files (x86)\VMware\VMware Workstation\vmrun.exe" -T ws stop "E:\Windows 7\Windows 7.vmx" nogui
echo 虚拟机已关闭
exit
把234.bat 放到关机中,注意,这里是计算机配置
![](https://www.sanradar.com/wp-content/uploads/2023/11/1700279535028.png)
系统关机挂起虚拟机,新建456.bat,放到关机中启动项
@echo off
echo 正在挂起虚拟机…
"C:\Program Files (x86)\VMware\VMware Workstation\vmrun.exe" -T ws suspend "E:\Windows 7\Windows 7.vmx"
echo 虚拟机已挂起
echo 请等待20秒以完成挂起的保存操作,20秒后自动关闭。
timeout /t 20
exit
如果想运行脚本挂起虚拟机,再关闭系统:
@echo off
echo 正在挂起虚拟机…
"C:\Program Files (x86)\VMware\VMware Workstation\vmrun.exe" -T ws suspend "E:\Windows 7\Windows 7.vmx"
echo 虚拟机已挂起
echo 请等待20秒以完成挂起的保存操作,20秒后自动关闭。
timeout /t 20
echo 正在关闭计算机…
shutdown /s /t 0
exit
理论支持所有Vmware版本,具体自己测试!
————————————————
版权声明:本文为CSDN博主「红客科技」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weizuer123/article/details/132778042
Excellent content! The clarity and depth of your explanation are commendable. For a deeper dive, check out this resource: EXPLORE FURTHER. What do you all think?
You really make it seem really easy together with your presentation however I in finding this matter to be
really one thing that I think I’d never understand. It seems too complicated and extremely large for me.
I’m looking forward to your next post, I will try to get the dangle of it!
Escape room
Quality posts is the main to interest the viewers
to visit the web page, that’s what this web page is providing.
I was looking through some of your articles on this
website and I conceive this site is rattling informative!
Retain posting.Blog monetyze
I like this blog it’s a master piece! Glad I
noticed this on google. Travel guide