How to change VirtualBox default VM location in command line

This is a global VirtualBox property, and can be set with the following command:

vboxmanage setproperty machinefolder /path/to/directory/

Be aware that this will not move already created VMs, it will affect only VMs which are created after the machinefolder property has been set.