Model, Component, and Package Management > Model management > Model Explorer > Command line interface - ScfUtils > Differencing models and packages through the command line interface (Model Explorer)
  
Differencing models and packages through the command line interface (Model Explorer)
Through the ModelDifferencer.exe command you can start the Differencer in its different contexts, and generate XML reports of differences.
Generating XML reports of differences directly through the command line interface is useful should you want to, for example, schedule a batch file that generates a difference report for a Model overnight.
Note that you can also perform Model Differencer operations through the Modeler Automation Interface. See the Modeler Automation Interface topics for the DiffModel and DiffPackage functions.
Arguments for different Model Differencer contexts
The ModelDifferencer.exe application can compare the following:
A model version with another version of the same model in the same database (-SV argument).
In Model Explorer and Modeler, this is the Difference > With Selected Version command.
A model with another model, which may be in a different database (-OM argument).
In Model Explorer, this is the Difference > With Selected Model submenu's commands. In Modeler, this is the Difference > With Other Model command.
A model version with the previous version of the model (-P argument).
In Model Explorer and Modeler, this is the Difference > With Predecessor command.
A sandbox with the latest version of the trunk (-LT argument).
In Model Explorer and Modeler, this is the Difference > With Latest Trunk command.
A sandbox with the version of the trunk from which the sandbox was created (-OT argument).
In Model Explorer and Modeler, this is the Difference > With Original Trunk command.
A Package with Package Export File (-PD argument).
In Modeler, this is a Package's Package Import/Export > Diff command.
A Package with the same Package in a different model (-PDO argument).
In Modeler, this is a Package's Diff With Other Model command.
A Model with its associated Model in a CM tool environment (-CM argument).
In Modeler, this is a Model's Configuration Management > Diff command.
A Package with its associated Package in a CM tool environment (-CM and -PD arguments).
In Modeler, this is a Package's Configuration Management > Diff command.
Arguments for generating reports and determining how errors and differences are returned
The ModelDifferencer.exe application can use the following arguments:
To generate an XML difference report (-R "<report file>" argument).
Note that through the Model Differencer dialog, you generate an XML difference report by clicking Generating Report on the Difference menu.
To keep the Model Differencer dialog open when using the -R argument (-K argument).
If the -R argument is used without the -K argument, the Model Differencer dialog is closed after generating the XML difference report.
To make the return code report whether there were any errors and a count of the number of differences should there be no errors (-B argument):
If there are errors, -1 is returned.
If there are no errors and no differences, 0 is returned.
If there are no errors and differences, the number of differences is returned.
To make the return code report whether there are errors or differences, do not include the -B argument:
If there are errors, 2 is returned.
If there were no errors and one or more differences, 1 is returned.
If there were no errors and no differences, 0 is returned.
Command line interface syntax
The ModelDifferencer.exe application resides in the Modeler Exe folder. If you have installed Modeler to the default location, the path of the Modeler Exe folder is as follows.
For 64-bit versions of Windows:
C:\Program Files (x86)\PTC Integrity Modeler\Modeler\Exe
For 32-bit versions of Windows:
C:\Program Files\PTC Integrity Modeler\Modeler\Exe
The ModelDifferencer.exe application is run through a command line with the syntax as follows:
For comparing a model version with another version of the same model in the same database (-SV argument).
ModelDifferencer -SV "<model>" "<second model>" [-R "<path and name of xml file>"] [-K] [-B]
For comparing a model with another model, which may be in a different database (-OM argument).
ModelDifferencer -OM "<model>" "<second model>" [-R "<path and name of xml file>"] [-K] [-B]
For comparing a model version with the previous version of the model (-P argument).
ModelDifferencer -P "<model>" [-R "<path and name of xml file>"] [-K] [-B]
For comparing a sandbox with the latest version of the trunk (-LT argument).
ModelDifferencer -LT "<model>" [-R "<path and name of xml file>"] [-K] [-B]
For comparing a sandbox with the version of the trunk from which the sandbox was created (-OT argument).
ModelDifferencer -OT "<model>" [-R "<path and name of xml file>"] [-K] [-B]
For comparing a Package with Package Export File (-PD argument).
ModelDifferencer -PD "<model>" "<package id>" "<directory>" [-R "<path and name of xml file>"] [-K] [-B]
For comparing a Package with the same Package in a different model (-PDO argument).
ModelDifferencer -PDO "<model>" "<package id>" "<second model>" [-R "<path and name of xml file>"] [-K] [-B]
For comparing a Model with its associated Model in a CM tool environment (-CM argument).
ModelDifferencer "<model>" -CM <model id> [-R "<path and name of xml file>"] [-K] [-B]
For comparing a Package with its associated Package in a CM tool environment (-CM and -PD arguments).
ModelDifferencer -PD "<model>" -CM "<package id>" [-R "<path and name of xml file>"] [-K] [-B]
Where:
<model> and <second model> is the Model Reference, as displayed on the General tab of a Model's Property Pages. For example, "\\SQL\Server\RepositoryName\Test\2".
<model id> is the id of the Model, as displayed on the Text tab of the Model's Property Pages. For example, "c3ba02ce-abd4-444f-8067-fb2aadac0585".
<path and name of xml file> is the path and name of the xml file you want to create. For example, "C:\Reports\Difference Report 1.xml".
<package id> is the id of the Package, as displayed on the Text tab of the Package's Property Pages. For example, "638177ce-3632-4122-9720-e002582f1d46".
<directory> is the path of the folder in which the Package Export File resides. For example, "C:\MyExports".
Examples
This example compares version 1 and version 3 of a model named New Model.
ModelDifferencer -SV "\\SQL\WS140\Models\New Model\1" "\\SQL\WS140\Models\New Model\3"
This example compares a sandbox (version 1.0.0) with the latest version of the trunk and generates a report to an xml file named Difference Report 1.xml. The Model Differencer window is closed after report generation because the -K argument is not included.
ModelDifferencer -OT "\\SQL\WS140\Models\Bob's sandbox of New Model v1\1.0.0" -R "C:\Reports\Difference Report 1.xml"
This example compares a Package with a Package Export File. The Model Differencer window remains open after report generation because the -K argument is included.
ModelDifferencer -PD "\\SQL\WS140\Models\New Model\1" "638177ce-3632-4122-9720-e002582f1d46" "C:\My Export Files" -R "C:\Reports\Difference Report 1.xml" -K