How to set "Default Machine Folder" Preference setting via command line?

Discussions related to using VirtualBox on Windows hosts.
Post Reply
ZillaG
Posts: 5
Joined: 26. Mar 2022, 02:13

How to set "Default Machine Folder" Preference setting via command line?

Post by ZillaG »

I'm installing VirtualBox on a Windows node via Ansible, and the task essentially just executes the following command

Code: Select all

VirtualBox-<version>-Win.exe --silent --ignore-reboot
After it's installed, how can I then change the equivalent GUI setting "File->Preferences->Default Machine Folder" via command line?

TIA
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: How to set "Default Machine Folder" Preference setting via command line?

Post by mpack »

Why do you want to do that? The "default machine folder" only controls where new VMs will be created, but all the command line methods for creating a VM allow you to set the target folder directly.

AFAIK the default machine folder setting can't be set from the command line, it's a private setting for the manager app which determines which parameter it will pass to the background process when creating VMs.

But, you could copy a template VirtualBox.xml file into the users\<user>\.VirtualBox folder, as that is where this setting is stored.
ZillaG
Posts: 5
Joined: 26. Mar 2022, 02:13

Re: How to set "Default Machine Folder" Preference setting via command line?

Post by ZillaG »

mpack wrote:Why do you want to do that? The "default machine folder" only controls where new VMs will be created, but all the command line methods for creating a VM allow you to set the target folder directly.

AFAIK the default machine folder setting can't be set from the command line, it's a private setting for the manager app which determines which parameter it will pass to the background process when creating VMs.

But, you could copy a template VirtualBox.xml file into the users\<user>\.VirtualBox folder, as that is where this setting is stored.
I'm trying to automate manual installation instructions from the development team, and one of them was to change the "Default Machine Folder" setting, So then how do I set the target folder when creating a new VM via the command line? I was given a script that takes an *.ova file as a parameter, and it's not clear to me, by looking at it, where the VM is created. I only see the following line in the script.

Code: Select all

%PATH_TO%\VboxManager.exe import %1
ZillaG
Posts: 5
Joined: 26. Mar 2022, 02:13

Re: How to set "Default Machine Folder" Preference setting via command line?

Post by ZillaG »

Ah I see https://docs.oracle.com/en/virtualizati ... mport.html

Code: Select all

%PATH_TO%\VirtualBoxManager.exe import %1 --basefolder F:\some_folder
Post Reply