VMware Communities
balsh
Contributor
Contributor

Opening file in guest

How do you open a file in a guest using host command-line?

For example, I can open Microsoft Word with runProgramInGuest, but what do I do if I want to open a particular Microsoft Word document?

Thanks!

Reply
0 Kudos
4 Replies
wila
Immortal
Immortal

Hi,

Have you tried to pass the document as an argument?

Here's the help on the subject:

runProgramInGuest

Runs a specified program in the guest operating system.

The -noWait option returns a prompt immediately after

the program starts in the guest, rather than waiting for it

to finish. This option is useful for interactive programs.

The -activeWindow option ensures that the Windows

GUI is visible, not minimized. It has no effect on Linux.

The -interactive option forces interactive guest login.

It is useful for Vista and Windows 7 guests to make the

program visible in the console window.

You must provide the full pathname of a program

accessible to the guest. Also provide full accessible

pathnames for any files specified in the program

arguments, according to requirements of the program.

VMware Tools and a valid guest login are required.

<path to .vmx file>

[ -noWait |

-activeWindow |

-interactive ]

<program name>

[ <program arguments> ]

see vmrun manual at: VIX API Documentation

--

Wil

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
Reply
0 Kudos
balsh
Contributor
Contributor

Thanks, it works... somewhat. Using -noWait -activeWindow -interactive, it does open, but it does not look normal; the majority of it is blacked out.

Reply
0 Kudos
balsh
Contributor
Contributor

How does this translate to passing command-line arguments to a Perl script to be run within the VM using runProgramInGuest? I was able to run a bat file within the VM calling the script also within the VM, but I was wondering if there is a way to just execute the script itself (likely requiring passing the Perl executable to run it via Perl obviously).

Reply
0 Kudos
wila
Immortal
Immortal

Hi,

For kicks I just tried it here on a Windows 7 guest and tried to open a word document using word and it just worked fine for me.

No black bars or anything. I did not use the latest MS Word, which might be a factor.

As for passing arguments to a script, I'm not understanding the question, you just pass them.

Note that there's also a runScriptInGuest where you do not pass a filename, but the actual script as a parameter (or so it says in documentation, the example they show does pass the script as a file, so not sure what extra's that gives you over runProgramInGuest (a script interpreter is just a program to after all)

--
Wil

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
Reply
0 Kudos