Page 2 of 2

Re: VBoxManage and filesnames with whitespaces

Posted: 3. Nov 2011, 10:19
by jorgensen
Maybe \a is considered as a beep character in the C code.
Why not use slash (/) for path separation to get around the backslash problem.

Re: VBoxManage and filesnames with whitespaces

Posted: 6. Dec 2011, 16:26
by kasi
jorgensen wrote:Maybe \a is considered as a beep character in the C code.
Why not use slash (/) for path separation to get around the backslash problem.
This unfortunately doesn't work as well. I'm surprised that nobody else ever ran into a similar problem when trying to pass parameters with whitespaces to programs via vboxmanage.

Re: VBoxManage and filesnames with whitespaces

Posted: 6. Dec 2011, 16:37
by mpack
I - along with most sane people - tend to avoid command lines. :D Seriously, only a fraction of users use the command line, of those only a fraction need to pass command lines via another command line, and of those only a fraction would need to pass spaces, and of those only a fraction would decide that they couldn't work around it. Not many people left after that!

Your difficulty also seems to an obscure one related to who exactly parses the command line and what code they use. I use Windows Hosts and Windows Guest and would not expect to have this problem.

I did attempt a (quick) look into the VBoxManage source tree for a command line parser, so we could settle this issue of how it treats doubled up quotes, mixed quote types, slashes etc. Unfortunately I didn't find it. It may be tucked away in a folder somewhere, but it looks like they rely on a standard library function to create the argv[] list for main(), in which case I could never be exactly sure about implementation details.

Re: VBoxManage and filesnames with whitespaces

Posted: 17. Apr 2012, 18:04
by Tom-
I have been fighting this problem for months in a very similar way as in the thread above. The workaround I've found is to construct in the host OS the complete command that is to be run in the guest, and put it in a batch file, and call the batch file with VBoxManage:

Code: Select all

echo "C:\WINDOWS\system32\cmd.exe /C start /B \"VB_XP\" \"$filename\"" > /tmp/VBXP2.bat
VBoxManage --nologo guestcontrol XP execute "C:\WINDOWS\system32\cmd.exe"  --username u --password p /C start /B Y:\\tmp\\VBXP2.bat
Note that:
- If the first argument of the start command is enlosed in double quotes, it thinks that it is the window title. For this reason I included a dummy title.
- The batch file location needs to be accessible from both host and guest OSes.
- You may want to preprocess the $filename to handle special characters, and to make sure the correct file path is passed to the guest OS.