Programmable interfaces provided by VMware Workstation

Source: Internet
Author: User

What is a vmrun command? In fact, this is not a mysterious thing. I believe some friends have used vmware workstation to install some virtual machines. If you are careful enough, you will find a vmrun.exe executable file under the installation directory of this software. If you break into vmrun.exe (You have to switch to the root directory of workstation), you will be surprised to find that many parameters are provided by this command, the functions of these parameters form a powerful connection bridge between the host machine and the guest machine. First, let's take a look at the commands available for us.

1. Power commands

For example:

As shown in the preceding figure, these command parameters can be used to enable or disable virtual machines ~

For example, you can run the command: vmrun start "d :\\ windows7 \ win7.vmx" to start the virtual machine. The start command is followed by the configuration file location of the Virtual Machine System to be started.

I will not repeat the other similar cases

2. snapshot commands

For example:

As the name suggests, this set of command parameters are mainly used to operate snapshots of virtual machine systems. What is a snapshot, in short, is the overall status information of the current system. The purpose of snapshot creation is to save the status of the current system, while reverttosnapshot can be restored from the current system status to the system status of the specified snapshot. This is not difficult for testers to understand, because the test must be in a clean system environment. The so-called clean test environment refers to an operating system from being created, only software and configurations related to the test have been installed on the above, and only one-time test can be performed. To achieve the goal of Multiple tests, you can only go through the continuous revert to the snapshot point of the clean test environment.

We can see that we can use commands to view all the system snapshots (listsnapshots), create snapshots for the system, and delete the specified snapshots (deletesnapshot) in the system) to restore a snapshot (reverttosnapshot), the command is as follows:

Create a snapshot:

Vmrun snapshot "d :\\ windows7 \ win7.vmx" "snapshot1"

However, in general, the above is still not good, especially when you wantCodeWhen you call this command to create a VM snapshot, the user name and password are often required for verification. So how to write it? The correct command is as follows:

Vmrun-gu User Name of your VM system-GP password of your VM System Snapshot "d :\\ windows7 \ win7.vmx" "snapshot1" (<= snapshot name)

Will the above command be successful? Not necessarily. If it still fails, please try the following three operations. If it still cannot solve your problem, then the author remains silent ~

1) First, check whether the creation of VM snapshots is supported.

The detection method is very simple. Check the snapshot sub-options under the VM option of the menu item of the workstation, such:

If all options in the right pop-up menu of snapshot are grayed out, you have to solve this problem first.

2) Check whether vmtools is playing tricks

Check whether vmtools is not installed in your virtual machine system or whether it can be updated. If it is not installed, install it. If it is installed, update it. For details about how to install or update it, see.

3) Add the user name and password of the local system for verification.

User Name of the vmrun-u host machine-password of the P host machine-username of the gu VM system-password of the gp vm System Snapshot "vmx path" "snapshot1"

3. Guest OS command

For example:

This set of commands is very practical. It is mainly used to perform a column of operations on the guest machine (that is, the Virtual Machine System) under the host machine, such as file operations, process operations, running specifiedProgramAnd run scripts. These commands require user name and password verification, that is, adding the-gu and-GP parameters to the command line. See the above.

In this command set, you may need to note that the runprograminguest command can execute some commands in the virtual machine system, such as opening a notepad and directly typing the following command:

Vmrun-gu guest system username-GP guest system password runprograminguest "D: \ windows7 \ win7.vmx" Notepad

If you want to open the 1.txt file under the C-root directory of the virtual machine, you can add parameters after the running program, as shown below:

Vmrun-gu guest system username-GP guest system password runprograminguest "D: \ windows7 \ win7.vmx" Notepad C :\\ 1.txt

If you call this command at the code level and want you to always be aware of the fact that the above command will not be returned until the program running on the guest machine ends by default. If, dear, you execute a series of commands in serial mode, and the previous command is a long wait program, then the program will often be suspended and cannot be executed. If you use the preceding command to open a text file, the main program will not return it until you close notepad in the guest system.

At this time, you can select the-Nowait switch command to select the unwaited execution, that is, each command will be returned after execution without blocking. The command is as follows:

Vmrun-gu guest system username-GP guest system password runprograminguest "d :\\ windows7 \ win7.vmx"-Nowait notepad C :\\ 1.txt

You can try other commands on your own.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.