vmware的命令行参数
vmrun命令行工具:对于自动化测试有如下实用命令行(-T代表目标类型,后更参数ws代表Workstation):lPower Commands:开启、停止、重启、挂起虚拟机vmrun -T ws start|stop|reset|suspend “path_of_wmx_file”例如: vmrun.exe-T ws start "F:\Ubuntu 64 位.vmx"在vmware中默认有界面
VMWare Workstation 7 自动化命令 - Roger Ge 的专栏 - 博客频道 - CSDN.NET
http://blog.csdn.net/roger_ge/article/details/5383769
vmware12的命令行文档
https://www.vmware.com/support/developer/vix-api/vix112_vmrun_command.pdf
VMWare Workstation在自动化测试可以得到很好的应用,原因在于其拥有强大的快照功能,能通过命令行方式方便的执行类似于Ghost的操作,这在准备干净的测试环境时用途非常明显。去年VMWare推出的最新Workstation7为Windows7提供了很好的操作平台,为Windows7的稳定运行提供了保障。
1. 命令行启动VMWare Workstation:
C:/Program Files/VMware/VMware Workstation/vmware.exe [-B] [-n] [-x] [-X]
[-t] [-q] [-s <variablename>=<value>] [-v] [<path_to_virtual_machine>/<virtual_machine_name>.vmx]
Option | Description |
-n | Opens a new Workstation window. |
-B | (Windows hosts only) Opens a new Workstation window but hides the sidebar and toolbars. Only the tabs of open virtual machines are shown. Using this option has the same effect as clicking the Workstation icon in the upperleft corner of the Workstation window and choosing Hide Controls from the menu that appears. |
-t | Opens a virtual machine or team in a new tab in the existing Workstation window. |
-x | Powers on the virtual machine when Workstation starts. This is equivalent to clicking the Power On button in the Workstation toolbar |
-X | Powers on the virtual machine and switches the Workstation window to full screen mode. |
-m | Starts the program in quick switch mode. |
-q | Closes the virtual machine’s tab when the virtual machine powers off. If no other virtual machine is open, it also exits Workstation. This option is useful when the guest operating system can power off the virtual machine |
-s | Sets the specified variable to the specified value. Any variable names and values that are valid in the configuration file can be specified on the command line with the -s switch |
-v | Displays the product name, version, and build number |
<path_to_virtual_machine> | Launches a virtual machine by using the specified virtual machine or team configuration file (.vmx or .vmtm file). |
2. vmrun命令行工具:
对于自动化测试有如下实用命令行(-T代表目标类型,后更参数ws代表Workstation):
l Power Commands:开启、停止、重启、挂起虚拟机
vmrun -T ws start|stop|reset|suspend “path_of_wmx_file”
例如: vmrun.exe -T ws start "F:\Ubuntu 64 位.vmx" 在vmware中默认有界面启动Ubuntu64位虚拟机系统
start,有两个参数gui|nogui,前者是默认参数,参数加在末尾
stop/reset/suspend有两个参数hard|soft,hard代表执行命令前不运行wmtools文件夹中对应的批处理文件,soft代表执行命令前运行批处理文件,参数加在末尾
l Snapshot Commands:创建、删除、还原快照
vmrun -T ws snapshot|deleteSnapshot|revertToSnapshot “path_of_wmx_file” “snap_shot_name”
Snapshot还有一个命令是listSnapshots,列出所有快照名
l Record and Replay Commands:
vmrun -T ws -gu <user> -gp <pass> beginRecording “path_of_wmx_file” “session_name”
vmrun -T ws -gu <user> -gp <pass> endRecording “path_of_wmx_file”
上述命令配对使用。
l Guest Operating System Commands:
此类型命令较多,摘取部分较有价值的列举如下:runProgramInGuest | runScriptInGuest | listProcessesInGuest | killProcessInGuest | fileExistsInGuest |deleteFileInGuest | renameFileInGuest | createDirectoryInGuest | deleteDirectoryInGuest | listDirectoryInGuest | copyFileFromHostToGuest |copyFileFromGuestToHost | captureScreen
更多命令请参考如下文档:
《Workstation User’s Manual》for VMWare Workstation 7
《Using vmrun to Control Virtual Machines》
更多推荐
所有评论(0)