Search code examples
bashmacosshellterminalvirtualbox

Passing Arguments to VirtualBox MacOS Terminal


Trying to pass some arguments into Terminal on a MacOS VirtualBox VM (from a Windows 10 host). I can get Terminal to launch correctly, but the arguments aren't working.

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" guestcontrol "MacOS High Sierra New" run "/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal" --username justin --password password --wait-stdout --"/c echo test"

Am I missing a flag or something? Also, if there's a better way to run shell commands in a VM, I'm all ears. Thanks!


Solution

  • Finally got it working after about 8 hours of trying different things:

    VBoxManage guestcontrol "vmname" run /bin/sh --username usr --password pass --verbose --wait-stdout --wait-stderr -- -c "echo test"