# Is VBoxManage guestcontrol passing parameters incorrectly?

I had an idea of using my Windows VM (on a Ubuntu host) to open itms:// links (for iTunes) from the host. So, I'm using vboxmanage guestcontrol to make this happen.

I have a script (win_vm_launcher.sh) that takes a link as the argument, and passes it to the host like this:

vboxmanage guestcontrol "$VM" exec --image 'C:\Windows\System32\cmd.exe' --username "$USER" --password "$PASSWORD" -- /c start "$@"


This works if I copy a link from my browser, and change http to itms. E.g., for https://itunes.apple.com/us/album/new-york-city/id3202598, I can do win_vm_launcher.sh itmss://itunes.apple.com/us/album/new-york-city/id3202598 and it works fine. The album opens up in iTunes on my VM.

However, when I click a "View in iTunes" link from the iTunes site, it adds an extra parameter to the URI (specifically, the referrer), so it looks something like itmss://itunes.apple.com/us/album/new-york-city/id3202598?ign-msr=https%3A%2F%2Fitunes.apple.com%2Fus%2Falbum%2Fit-came-upon-midnight-clear%2Fid578946739

Unfortunately, if I try to run win_vm_launcher.sh itmss://itunes.apple.com/us/album/new-york-city/id3202598?ign-msr=https%3A%2F%2Fitunes.apple.com%2Fus%2Falbum%2Fit-came-upon-midnight-clear%2Fid578946739 it insteads opens up a regular Command Prompt window with the title "itmss://itunes.apple.com/us/album/new-york-city/id3202598?ign-msr=https%3A%2F%2Fitunes.apple.com%2Fus%2Falbum%2Fit-came-upon-midnight-clear%2Fid578946739". I don't even know how to set the command prompt window title, so I'm not sure how that's happening.

If I run the command in the guest, it works fine, opening the album in iTunes:

cmd /c start itmss://itunes.apple.com/us/album/new-york-city/id3202598?ign-msr=https%3A%2F%2Fitunes.apple.com%2Fus%2Falbum%2Fit-came-upon-midnight-clear%2Fid578946739


I found a VirtualBox bug that seems somewhat related, but not exactly.

It probably doesn't matter, but my host is Ubuntu 12.04, and my guest is Windows 7.

So, any idea if vboxmanage is incorrectly passing the arguments, and if so, is there a way around it?

If I can't figure out the right way to do it, I'll end up having to process each argument, and stripping out any parameters on any URIs.

### P.S.

I tried creating a batch script (out.bat) like this:

echo %1 > %TEMP%/testing.txt


and then running it from the host like this: vboxmanage guestcontrol "$VM" exec --image 'C:\Windows\System32\cmd.exe' --username "$USER" --password "$PASSWORD" -- /c "C:\path\to\out.bat" "itmss://itunes.apple.com/us/album/new-york-city/id3202598?ign-msr=https%3A%2F%2Fitunes.apple.com%2Fus%2Falbum%2Fit-came-upon-midnight-clear%2Fid578946739" It ran as expected, and when I open %TEMP%/testing.txt, it contained: "itmss://itunes.apple.com/us/album/new-york-city/id3202598?ign-msr=https%3A%2F%2Fitunes.apple.com%2Fus%2Falbum%2Fit-came-upon-midnight-clear%2Fid578946739" including the quotes. So, it sort of passed the parameter correctly (not sure why it still had quotes), so maybe the problem is with cmd.exe, or even the start command. I'm stymied. - Instead of using the shell script try to run the command directly and see what happens. I think the passing the parameters through wim_vm_launcher.sh might be doing something with your values. – Zero Nov 21 '12 at 21:49 @Zero, did that. Running cmd.exe /c ... from the guest works fine, but running the vboxmanage ... command from the host produces the exact same results. So, it's not the script. It's either vboxmanage, or cmd.exe, I think. – Dan Jones Nov 21 '12 at 22:24 ## 1 Answer Well, I found a work-around. I think the problem was with cmd.exe, but I'm not sure what, because I found a way to get it to work using PowerShell instead. The script now reads: vboxmanage guestcontrol "$VM" exec --image 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' --username "$USER" --password "$PASSWORD" -- "% {Start-Process \$1}"


Of course, this solution won't work for anyone using Windows XP, but seriously, is anyone still using it (at least in a VM)?

The only problem is that the PowerShell window opens briefly, but that's really no big deal.

I set the script as the default handler for itms and itmss protocols, and so now when I click on a "View in iTunes" link on the iTunes website on my host in Chrome, it launches iTunes in my Windows guest.

-