Automate Virtual Machine Startup in Windows

VirtualBox logo

If you run a VirtualBox VM that you want up and running all the time, it’s handy to have it start automatically when you log in, rather than launching it by hand each time. This guide covers doing exactly that on Windows, using a small batch file in the Startup folder to boot the VM in headless mode.

Step 1: Open the Startup Folder

Windows runs anything placed in your Startup folder automatically when your user account loads. You can navigate to it directly, replacing <YourUsername> with your own:

C:\Users\<YourUsername>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

An easier way is to press Win+R to open the Run dialog, type shell:startup, and hit Enter, which drops you straight into the same folder.

Step 2: Create a Batch File

Inside the Startup folder, right-click and choose New, then Text Document. Rename it to something descriptive with a .bat extension, such as VMStartup.bat, and make sure the file type actually changes to a batch file rather than staying a .txt. If you can’t see file extensions, enable “File name extensions” in Explorer’s View menu first.

Step 3: Add the Startup Command

Open your new .bat file with Notepad and add the following line:

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" startvm "NameOfYourVM" --type "headless"

Replace NameOfYourVM with the exact name of the VM you want to start. The --type "headless" part is what makes this convenient, since it boots the VM in the background where it won’t get in your way. You can still open it normally through the VirtualBox interface whenever you want to bring it to the foreground.

Save the file and close Notepad. From now on, that VM will start automatically in headless mode whenever you log in to Windows, which is a simple way to keep a server or always-on VM running without thinking about it.

Related guides


Comments

Leave a Reply

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