Switches used in the command line
Last modified: March 28, 2025
This topic gives a detailed description of command-line switches and examples of their usage.
You can select the required options while setting the comparison in the Data Comparison wizard and generate a file with command line arguments by clicking Save settings to a file.
Access available Data Compare switches
To access help regarding the available command line arguments, use the following command:
datacompare.com /?
For more information on each command-line operation, run the following command and specify the required option value datacompare /option_name /?
. For example, datacompare /report /?
.
Note
To run the Command Line in Windows 11:
From the Windows taskbar
- Right-click the taskbar at the bottom of the screen and select Run. Alternatively, select Start or press Windows on the keyboard to open the Start menu.
- In the Search bar, enter cmd or Command Prompt.
- Select Command Prompt from the search results.
Using shortcut keys
- Press Windows + R to open the Run command window.
- In the window that opens, enter cmd and press Enter.
Command line usage
datacompare [/argfile:filepath] [/option_name1[:value | [parameter1:value parameter2:value ..]] /option_name2 ..]
The first argument for datacompare is usually an operation switch, which indicates the specific action you want to execute with the application.
Available command-line switches
/datacompare
Launch data comparison.
Parameter | Description |
---|---|
source |
Specifies source with the following options: |
Usage: server:<name> database:<db> [user:<name>] [password:<pw>] Connects to a live database by specified parameters. If ‘user’ is not specified, the system’s integrated security is used. |
|
Usage: connection:<connection_string> Allows specifying the full connection string with additional parameters. |
|
Usage: backup:<filepath> [backup:<filepath> ...] Specifies the file path to a SQL Server backup file (.bak) or backup files taken from the differential backup. |
|
target |
Specifies target with the following options: |
Usage: server:<name> database:<db> [user:<name>] [password:<pw>] Connects to a live database by specified parameters. If ‘user’ is not specified, the system’s integrated security is used. |
|
Usage: connection:<connection_string> Allows specifying the full connection string with additional parameters. |
|
Usage: backup:<filepath> [backup:<filepath> ...] Specifies the file path to a SQL Server backup file (.bak) or backup files taken from the differential backup. |
|
compfile |
Usage: /compfile:<filepath> . Loads command line settings from comparison .dcomp project file. |
option |
Usage: /{option}:[value] . Specifies the value for comparison or synchronization option. To turn on the option, specify: Yes, Y, On, True, T. To turn off the option, specify: No , N , Off , False , F . You can use this switch as many times as many options you want to specify. |
sync |
Usage: /sync[:filepath] Launches database synchronization. If an output file path is specified, the program will generate only a synchronization script. |
report |
Usage: /report:<filepath> . Generates a schema comparison report. If the output file name ends in .html, .xls, or .xml, the file format will be automatically determined based on the extension. Please see the documentation to learn more about report formats. |
reportformat |
Usage: /reportformat:<HTML|XLS|CSV> . Specifies the format of the file comparison report: HTML - a simple HTML file; XLS - a simple Microsoft Excel file; CSV - a simple CSV file. If the format was not specified, it is determined by the extension of the report file. |
log |
Usage: /log:<filepath> . Writes a comparison log to the specified file. |
exitcodes |
Lists possible exit codes that can be returned by the command-line process. |
Usage examples
1. Compare data using settings from a file saved earlier:
datacompare.com /datacompare /compfile:"D:\workDir\DC1vsDC2.dcomp"
2. Compare and synchronize data using a connection string. To write a log to the specified file, use: /log:”D:\sync.log”.
datacompare.com /datacompare /source connection:"Connection Lifetime=120;Host=pgSqlHost;Port=5435;Database=db1;User ID=yourusername;Password=yourpassword;Pooling=False" /target connection:"Connection Lifetime=120;Host=pgSqlHost2;Port=5436;Database=db2;User ID=yourusername;Password=yourpassword;Pooling=False" /sync /log:"D:\sync.log"
3. Compare data of the specified databases and save the synchronization script to the file, use: /sync:”D:\compare_result.sql”
datacompare.com /datacompare /source server:db port:5440 user:yourusername password:yourpassword database:db1 /target server:db2 port:5440 user:yourusername password:yourpassword database:db2 /sync:"D:\compare_result.sql"
4. Compare and synchronize data using settings from the file, do not generate comments in the synchronization script, generate a report to the specified file in the HTML format:
datacompare.com /datacompare /compfile:"DC1vsDC2.dcomp" /nocomments:yes /report:"report.txt" /reportformat:HTML /sync
5. Compare data and generate data report using settings from a file. Comparison and data writing settings of the different objects will be included into the report.
datacompare.com /datacompare /compfile:"DC1vsDC2.dcomp" /report:"report.html" /incdata:Yes /incsettings:Yes
Note
You can use the Command-line Wizard to automatically generate command-line syntax.