第一步,编写虚拟机挂起和开启的脚本.
vm_stop.bat
"D:\Program Files\VMware\vmrun.exe" suspend "E:\Shared Virtual Machines\C05-64\C05-64-111.vmx" "D:\Program Files\VMware\vmrun.exe" suspend "H:\Virtual Machines\C04-64-21\C04-64-21.vmx"
vm_start.bat
ping 127.0.0.1 -n 5 #设置登录后,过几秒钟再启动虚拟机.
"D:\Program Files\VMware\vmrun.exe" start "E:\Shared Virtual Machines\C05-64\C05-64-111.vmx" "D:\Program Files\VMware\vmrun.exe" start "H:\Virtual Machines\C04-64-21\C04-64-21.vmx"
第二部,打开windows的"本地组策略编辑器"
找到"用户配置"->"windows设置"->"脚本(登录/注销)"
打开登录,设置启动脚本问vm_start.bat
打开注销,设置启动脚本问vm_start.bat
设置成功,测试.