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?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
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.
vboxmanage is the way to go
vboxmanage startvm "winxppro Clone"
man vboxmanage or documentation can be found here
<vm>your vm name)
vboxmanage controlvm <vm> savestatesaves the current status
vboxmanage controlvm <vm> resumeresumes the previous saved state
vboxmanage controlvm <vm> poweroffplugs off your machine cable
I will try to elaborate on @Philippe answer:
-- before the startvm
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
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.
In Windows 10, you can start a Ubuntu VM using:
C:\Program Files\Oracle\VirtualBox\VBoxManage.exe startvm Ubuntu
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.