How to Add VBoxManage To Path

Add VBoxManage command to Windows PATH

The VBoxManage command manages the Oracle VM VirtualBox application from the command line. But how do we add the VBoxManage command to the Windows PATH environment variable?

You must add the folder containing VBoxManage.exe to the PATH if you type VBoxManage at the Windows command prompt and get

‘VBoxManage’ is not recognized as an internal or external command,
operable program or batch file.

You expect VBoxManage to print a list of command options.

How to Add VBoxManage to the Windows PATH

Use the below steps.

  1. Find the folder VBoxManage.exe is in
  2. Verify the VBoxManage folder you have
  3. Add the VBoxManage folder to your classpath
  4. Close & open CMD prompt. Re-issue VBoxManage
  5. DRY (Don’t Repeat Yourself)

1. Find VBoxManage.exe directory

It is usually here

"C:\Program Files\Oracle\VirtualBox"

It’s good to know the below steps.

  1. Go to the VirtualBox ICON on your desktop or inside your StartMenu
  2. Hover over it and Right Click mouse
  3. Click on Properties
  4. You’ll see
    "C:\Program Files\Oracle\VirtualBox\VirtualBox.exe"
  5. Cut off the last backslash AND VirtualBox.exe
  6. Now you have the VirtualBox and VBoxManage install folders

2. Verify the VBoxManage folder

Test the VBoxManage folder by running the below on the command line

"C:\Program Files\Oracle\VirtualBox\VBoxManage"

Warning – Don’t forget the “quotes”. If you do the command line will throw this at you!

dir C:\Program Files\Oracle\VirtualBox\VBoxManage
The system cannot find the path specified.

If the VBoxManage command prints the below (and more) you have the right VBoxManage directory.

"C:\Program Files\Oracle\VirtualBox\VBoxManage"
Oracle VM VirtualBox Command Line Management Interface Version 4.3.20
(C) 2005-2014 Oracle Corporation
All rights reserved.

3. Add the VBoxManage folder to your classpath

Adding a folder to the Windows PATH environment variable can be done in 3 ways, one good, one bad and one ugly.

  • using a PowerShell script changes it permanently (good way)
  • using SET changes it just for your shell instance. (bad way)
  • doing it manually via My Computer – Environment Variables (ugly way)

The bad way (using the SET command) is also the quickest. Run the SET command below to add the VBoxManage folder to the classpath. Again – do not forget the “quotes”.

set PATH=%PATH%;"C:\Program Files\Oracle\VirtualBox"

4. Verify the VBoxManage folder is on the PATH

To verify it you type the SET command again with no arguments.

set

Now look at the output and find the line that starts with PATH=. At the end of this line should be the VBoxManage folder path. (This time it is fine if no quotes surround the recently added PATH).

You’re done if you want VBoxManage for this shell instance.

If you want it done permanently then you’ve opted for using the PowerShell Add Folder to Path script. Or you’ve done it manually via My Computer -> Properties -> Advanced -> Environment Variables options.

Either way you must bounce the command prompt and test again with a new shell instance. Once re-opened you retry with the below command.

VBoxManage

If the VBoxManage command prints the below you’ve done it. Well done!

"C:\Program Files\Oracle\VirtualBox\VBoxManage"
Oracle VM VirtualBox Command Line Management Interface Version 4.3.20
(C) 2005-2014 Oracle Corporation
All rights reserved.

5. The DRY Principle – Don’t Repeat Yourself

The Agile manifesto preaches the DRY principle, meaning Don’t Repeat Yourself.

So why not use a batch or powershell script to install VirtualBox and straight
after that add the VBoxManage command to the classpath.

You should always automate actions geared towards MMLINKMM-Building Application Service Environments

3 comments

Leave a Reply

Your email address will not be published. Required fields are marked *