Vmware虚拟机实现自动\开机启动\关机挂起脚本命令

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 放到登录中, 注意,这里是用户配置.

系统关闭自动关闭虚拟机,新建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 放到关机中,注意,这里是计算机配置

系统关机挂起虚拟机,新建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

sanradar
sanradar
文章: 97

4 评论

  1. 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?

  2. 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

留下评论

您的电子邮箱地址不会被公开。 必填项已用 * 标注