How-To: Start VBox VM Using Scripts / Command Lines

From my previous post on how to run Bootcamp in VirtualBox, I just realize I forget to mention this launching tip, so here it is.

VirtualBox is a fantastic freeware. I really love it. It may not be as feature rich or efficiently good as other paid alternatives like VMware or Parallel, but it offers lots of great functionality, and is in active development.

To start a virtual machine (of VirtualBox) using command lines:

In Mac or Linux, open Terminal and type

vboxmanage startvm (vmname)

replace (vmname) with yours, for example Ubuntu, press Enter. That’s it.

If you use Linux, you can save this as a script file, and use it to start the vm instead.

In Mac, there is a neat and pretty way to start vm as app, using AppleScript. In AppleScritp Editor, type

do shell script "vboxmanage startvm (vmname)"

and save the file as an Application.

Save as Applications
By launching this app, it starts your VM. You can also change its icon, so it looks pretty and easy to recognize. This is how mine looks. I use Windows and Ubuntu icons found from the Internet (so they’re not mine), so I can distinguish them and they blend in my Applications folder well enough.

VM icons

New Pretty Icons

For Windows, you use similar approach with batch files. In Notepad, type this 2 lines in

cd "c:\Program Files\Oracle\VirtualBox"

vboxmanage startvm (vmname)

save as .bat file, and there you go, double click it to start the specified virtual machine.

Tips: If you don’t know what is your vm name, use this commands in Dos or Terminal, :wink:

vboxmanage list vms