view/157 这种方式会启动VMWare的窗口,不太友好,可以使用vmrun命令管理虚拟机
创建 vm_centos.bat文件
@echo off "D:\Program Files (x86)\VMware\VMware Workstation\vmrun.exe" start "E:\VMware\CentOS7\CentOS7.vmx" nogui
"D:\Program Files (x86)\VMware\VMware Workstation\vmrun.exe" 为VMWare虚拟机的安装路径。
"E:\VMware\CentOS7\CentOS7.vmx" 为虚拟机已安装系统的路径,注意是.vmx扩展名的文件。
2.设置开机启动项
找到启动文件夹,一般是C:\Users\用户名\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
或者打开运行(win+R),输入shell:startup,回车,也可以快速打开启动文件夹。
把vm_centos.bat文件移动到启动文件夹即可。
vmrun常用命令示例
Examples: Starting a virtual machine with Workstation on a Windows host vmrun -T ws start "c:\my VMs\myVM.vmx" Running a program in a virtual machine with Workstation on a Windows host with Windows guest vmrun -T ws -gu guestUser -gp guestPassword runProgramInGuest "c:\my VMs\myVM.vmx" "c:\Program Files\myProgram.exe" Creating a snapshot of a virtual machine with Workstation on a Windows host vmrun -T ws snapshot "c:\my VMs\myVM.vmx" mySnapshot Reverting to a snapshot with Workstation on a Windows host vmrun -T ws revertToSnapshot "c:\my VMs\myVM.vmx" mySnapshot Deleting a snapshot with Workstation on a Windows host vmrun -T ws deleteSnapshot "c:\my VMs\myVM.vmx" mySnapshot Enabling Shared Folders with Workstation on a Windows host vmrun -T ws enableSharedFolders "c:\my VMs\myVM.vmx"