43

I want to know how to start a VirtualBox Virtual Machine (VM) from the command line (using Windows 7) as well as shut it down with the operating system.

What is an easy way to achieve this?

1
  • Actually VirtualBox will recognize a host system shutdown initiated by the user Commented May 10, 2013 at 14:31

6 Answers 6

52

Here's the command I run from a shortcut I have on my desktop. This should work from a command line as well.

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" startvm <NameOfVMHere>

Of course, this is based on typical system defaults. Any given system might have moved the Program Files folder or installed VirtualBox to a custom location.

2
  • Thanks a million! this command actually has everything anybody would ever do with a VM ^^ Commented Nov 30, 2010 at 14:30
  • It's worth noting that the name of the VM is case-sensitive. You'll also need to surround it with quotes if it has spaces in it, and possibly (haven't tried this) escape any other characters that the command processor treats specially. I see mention of possibly needing to preface the "startvm" operand with "--". That doesn't work for me - I get an "invalid command" error.
    – rossmcm
    Commented May 24, 2018 at 21:15
14

vboxmanage is the way to go

vboxmanage startvm "winxppro Clone"

man vboxmanage or documentation can be found here

While (<vm> your vm name)

  • vboxmanage controlvm <vm> savestate saves the current status
  • vboxmanage controlvm <vm> resume resumes the previous saved state
  • vboxmanage controlvm <vm> poweroff plugs off your machine cable
2
  • 1
    Could you expand on the answer? It only answers to start-up and not the shut down.
    – suspectus
    Commented Jun 23, 2013 at 8:56
  • Please provide a bit more explanation about why your post answers the question.
    – teylyn
    Commented Jun 23, 2013 at 9:30
4

I will try to elaborate on @Philippe answer:
Try adding -- before the startvm The command: vboxmanage startvm <machine_name> will start the server which name is "machine_name".
For example if you have a machine that called UbuntuServer then the command will look like so: vboxmanage --startvm UbuntuServer

Note vboxmanage should be in you path to run this command. Add if to your path if not (on my mac it was added with the installation of virtual box.

3

In Windows 10, you can start a Ubuntu VM using:

C:\Program Files\Oracle\VirtualBox\VBoxManage.exe startvm Ubuntu

where Ubuntu is the name of the VirtualBox VM

To shut down the VM use:

C:\Program Files\Oracle\VirtualBox\VBoxManage.exe controlvm Ubuntu poweroff

You can also use other commands with controlvm such as pause, resume, reset, poweroff, savestate to achieve different actions.

1

I started a VM in this way:

VirtualBox.exe --comment "Ubuntu 16" --startvm "96852e73-a304-4357-b7ef-440913601f3f"

It starts headless I think.. no gui shown.. Now I wish to see the GUI of that VM from the HOST... is it possible?

0

At this point, you don’t have to use the command line to change video memory settings; there’s a slider for it in Details

Image

There is a button with the caption Video Memory

Click Video Memory

It opens up a window with a slider that goes up to 256 MB of video memory. Now you won’t have to figure out how to open up the command line, like I did! (You should still find out, though.)

2
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Jan 5 at 13:44
  • Why on earth would I need a citation when there is image proof right in the post Commented Jan 9 at 19:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .