VMware Communities
tmanning
Contributor
Contributor

vmrun runProcessInGuest - issues with 'complex' arguments

I'm trying to automate some debugging tasks in my windows guest using vmrun runProcessInGuest. The simple case works just fine:

vmrun -gu u -gp p runProgramInGuest GuestVM.vmx "c:\program files\debugging tools for windows\windbg.exe"

Using this command, windbg starts running. The goal is to have windbg debugging an application (e.g. Excel). Using this command line also works (please notice that in this version, I'm not quoting the exe names, I'm using the backslash/double-backslash thing:

vmrun -gu u -gp p runProgramInGuest GuestVM.vmx c:
program\ files
debugging\ tools\ for\ windows
windbg.exe c:
program\ files
microsoft\ office
office11
excel.exe

That command causes windbg to run, and windbg successfully loads excel and is ready to debug. But, I also need to pass args to excel, to have it open a file:

vmrun -gu u -gp p runProgramInGuest GuestVM.vmx c:
program\ files
debugging\ tools\ for\ windows
windbg.exe c:
program\ files
microsoft\ office
office11
excel.exe c:
documents\ and\ settings
developer
desktop
work
Book1.xls

This also works as expected, which might beg the question, "what's the problem?" I'm getting to it! Smiley Wink

*This command barfs:

vmrun -gu u -gp p runProgramInGuest GuestVM.vmx c:
program\

files
debugging\ tools\ for\ windows
windbg.exe -Q -W _NotQuite c:
program\

files
microsoft\ office
office11
excel.exe c:
documents\ and\

settings
developer
desktop
work
Book1.xls

Windbg tries to run a program " -Q -W _NotQuite c:
program\

files
microsoft\ office
office11
excel.exe" -- it seems like the dashed cmdline arguments are throwing a wrench in the works. I worked around this by writing a batch file and running that, but I would like to be able to specify crazy command line args like this, so I don't have to craft batch files every time I want to debug an application that also takes cmdline args...

Also, I tried several versions of the command line - e.g. using quotes to group different parts of the commands, backslashes -- every combination I could think of.

Is there something I'm missing, or is this really a bug? vmrun being in fusion 2.0 is an awesome addition.

Thanks.

-t.

0 Kudos
5 Replies
tmanning
Contributor
Contributor

hm... my argument lists got mangled by the CMS....

0 Kudos
admin
Immortal
Immortal

Try using "" before and after commands (you can use the same tag for the beginning and end, the CMS just seems to match them up in pairs). That should prevent the mangling so that we can get to your issue.

0 Kudos
choan
Contributor
Contributor

Hi.

I've run into the same issue and haven't found a solution.

I'm trying to start Internet Explorer with a URL by using

 vmrun -T fusion -gu my_user -gp my_pass runProgramInGuest /Users/choan/Virtual\ Machines/Imaged\ from\ Parallels\ VM.vmwarevm/Imaged\ from\ Parallels\ VM.vmx -noWait C:\\Archivos\ de\ programa\\Internet\ Explorer\\IEXPLORE.EXE example.com

But Explorer gets the argument as "example.com" (quotes INCLUDED) and tries to search MSN instead of going to http://example.com

I think I've tried every variation for quotes and escaping. No result.

tmanning, I've tried to create a batch file, but vmrun says it cannot find the file Smiley Sad

Any idea anyone?

0 Kudos
admin
Immortal
Immortal

I guess my first suggestion would be to use Firefox, since it can handle quotes around URLs :-). Heck, Chrome also seems to be able to figure it out.

vmrun quotes each argument it passes to the guest, mostly because it is really a pain to try to check each argument to see if would need quoting, especially since we'd need to check based on the guest OS's rules. That said, we had not seen too many issues where extra quotes caused a problem before.

Anyway, after way too much trial and error, this seems to work:

 vmrun -T fusion -gu my_user -gp my_pass runScriptInGuest /Users/choan/Virtual\ Machines/Imaged\ from\ Parallels\ VM.vmwarevm/Imaged\ from\ Parallels\ VM.vmx "" "\"C:\\Archivos\ de\ programa\\Internet\ Explorer\\IEXPLORE.EXE\" example.com

You do loose the ability to run the command with the -noWait option, but at least the terminal has '&'.

0 Kudos
choan
Contributor
Contributor

Actually, I needed to launch the pages on Internet Explorer, as there is some javascript unit testing involved.

Finally -after way too much trial and error, too- I created a batch file which launches the browser after removing quotes from the url parameter.

Thx.

0 Kudos