4

I am trying to call Beyond Compare Windows app to perform a file compre directly from Mac but I am block with command line argument passing.

You can call Windows applications from the OS X command line via something like:

open "$HOME/Applications (Parallels)/{ca50aac6-caa6-47a6-9bfe-e38f6261cb8d} Applications.localized/python.exe.app" --args -v

Still, it seems that there is a problem when you try to pass arguments.

4

APPROACH 1

This approach is a hack, but works with the least expensive version of Parallels.

On the virtual Windows machine:

  • Create a *.bat file for each possible set of parameters. For example:
     @echo off
     start "" "C:\Program Files (x86)\MyApplication.exe" --myArg
     exit

On the Mac:

  • Navigate to $(HOME)/Applications (Parallels)/VMNAME Applications, where VMNAME is the name of a virtual machine.
  • Duplicate the MyApplication.app application bundle and rename the duplicate MyApplication --arg.app.
  • Right-click MyApplication --myArg.app and choose "Show Package Contents*.
  • Open Contents/Resources/AppParams.pva in an editor (e.g., TextEdit), and change the value of the App Path property to the absolute path in the virtual machine to the *.bat file, rather than the application. Save the file.

This is similar to @johnl's answer above, which provided the vital clue. However, at least in Parallels 11, the App Path property would only work with an application path, not with a command line.

APPROACH 2

As of Parallels 11, this approach requires one of the more expensive editions of Parallels - Pro or Business. I don't have either, and haven't tested this approach.

According to the Parallels manual Parallels Desktop for Mac Pro Edition, the command prlctl exec can accept a command to be executed on the Windows virtual machine.

prlctl exec

Executes a command inside a virtual machine. Parallels Tools must be installed in a virtual machine to use this utility. Commands in Linux guests are invoked with bash -c.

Syntax

prlctl exec vm_id|vm_name command

Parameters

Name Description

vm_id|vm_name The UUID or the name of the virtual machine.

command A command to execute.

  • I like the sound of approach 2 but it doesn't work for me on my Windows 10 VM. I can exec ... cmd.exe (but this starts an interactive shell in the host terminal, it doesn't open cmd up inside the guest). If I try something like exec ... notepad.exe then nothing happens at all. – cdlk Oct 26 '15 at 15:34
  • @cdlk - I'm not able to test this approach myself. In your case, did you start the command with prlctl? Do you have Parallels 11 with the Pro or Business edition? – Andy Thomas Oct 27 '15 at 12:26
  • No worries. I'm actually evaluating the trial version of Parallels Pro 11 at the moment. I contacted Parallels support earlier on (re. exec on Windows VMs) and they pointed me towards approach 1 instead, so I guess this isn't supported on Windows. Out of interest, on OSX VMs, I can run prlctl exec ... open /Applications/Notes.app/ and this opens the notes app in the guest as you'd expect. – cdlk Oct 27 '15 at 17:42
  • Unfortunately Parallels' prlctl does not seem to allow passing command line arguments or setting environment variables in the guest app, without kluges such as placing such things in a file to pass across the Host/Guest boundary. By comparison, VirtualBox makes this easy to do: VBoxManage guestcontrol start [--exe] [--putenv][--unquoted-args]. More and more I regret having chosen Parallels rather than VirtualBox. – Krazy Glew Dec 23 '16 at 19:46
1

this is a neat hack to get parameters passed to your windows applications:

http://forum.parallels.com/threads/batch-files.11285/

The salient pieces:

  1. copy and rename the Windows Command Processor.app application bundle in your Parallels Applications directory. (should be in ~/Applications (Parallels)/{<GUID>} Applications.localized).
  2. edit Renamed Windows Command Processor.app/Contents/Resources/AppParams.pvaand change the App Path property to ...\cmd.exe /C <path-to-windows-executable> <parameters>
  • Thanks for this. I think that this means that the <parameters> need to be hardwired in the AppParams.pva file. Is there any way to pass these from the MacOS environment or command line? I.e. to have a MacOS script (e.g. bash) take command line parameters that it passes across Parallels to a script in the Windows guest? (Apart from modifying the .app bundle or the AppParams.pva file on the fly, which is annoying to make MP safe; generating is MP safe, but leaves garbage that mist be cleaned up.) – Krazy Glew Dec 23 '16 at 17:49
  • I vaguely remember this working when I first started using Parallels circa 2 years ago in 2015 - editing the .app bundle AppParams.pva and changing the command. Not enough for me to really start using it. But working enough that I thought it might eventually be made to work. // Unfortunately, now, in 2017, 2 years later and several updates of Parallels and MacOS, it works not at all. In fact, when I do such edits, even just adding a single blank character after cmd.exe fails - when I run such a bundle, it gets deleted !!! // Probably some security feature, but I am stymied. – Krazy Glew Jan 4 '17 at 17:30
  • As described in stackoverflow.com/questions/41456329/… I have switched to using VirtualBox for automation, because because I was not able to get any form of parameterized automation of GUI apps running across Parallels. But I would love to get automation across Parallels working, since Parallels does some things better than VirtualBox. – Krazy Glew Jan 4 '17 at 17:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .