How to execute a Parallels Windows application with command line parameters from Mac?

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.


Solution 1:

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.

Solution 2:

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>