Code Compare Integration with Perforce

You can set an external application to serve as your default diff and merge tool in Perforce. Here, we'll show how to integrate an external tool with Perforce, using Code Compare as an example.

Configure Code Compare as Diff Tool for Perforce

In order to set Code Compare as the default diff tool for Perforce, perform the following steps:

  1. Go to Edit → Preferences → Diff, select "Other application".
  2. Enter the following data in the respective fields:

    Location: "[InstallationDir]\CodeCompare.exe"

    Arguments: %1 %2

Perforce Diff Tool

Configure Code Compare as Merge Tool for Perforce

In order to set Code Compare as the default merge tool for Perforce , do the following:

  1. Create a .bat file. To do that, create a text document and change its extension from .txt to .bat. Then, open it with any text editor and add the following line:

    "c:\Program Files\Devart\Code Compare\CodeMerge.exe" /BF=%1 /TF=%2 /MF=%3 /RF=%4 /SC=P4

    Save and close the document.

  2. Go to the Perforce Settings: "Edit → Preferences → Merge", select "Other application".
  3. Enter the following data in the respective fields:

    Location: "[path to the .bat file]"

    Arguments: %b %1 %2 %r

Perforce Merge Tool

In order to use Code Compare with the Perforce command line:

  1. For Diff, execute the following command to specify the path to CodeCompare.exe:

    p4 set P4DIFF="[InstallationDir]\CodeCompare.exe"

  2. For Merge, execute:

    p4 set P4MERGE="[path to the previously created .bat file]"


Note: Use your product installation folder instead of [InstallationDir]. By default, it is C:\Program Files\Devart\Code Compare.