Automate script execution

You can automate script execution using the command line.

Note

To run the Command Line in Windows 10:

From the Desktop Mode

  • Move the mouse cursor to the exact lower left corner until the desktop shortcuts menu appears.
  • Right-click to see the shortcut menu and than click Run.

From the Charms Bar

  • Move your mouse to the upper right corner until the Charms Bar appears.
  • Select Apps from the list and type ‘run’ in the search box.
  • Click Run from the search results.

Use Windows + R Shortcut Keys

  • In desktop mode, press the Windows + R keys, to show the Run command line.
  • In the window that opens, type cmd and press Enter.

1. Type a path to the datacompare.com file located in dbForge Data Compare for MySQL Server installation folder on your PC, and then press SPACE.

C:\Program Files\Devart\dbForge Compare Bundle for MySQL Standard\dbForge Data Compare for MySQL Server\datacompare.com

2. To execute the corresponding script, use the /execute command, and press the SPACE key.

C:\Program Files\Devart\dbForge Compare Bundle for MySQL Standard\dbForge Data Compare for MySQL Server>datacompare.com /execute /?

3. Specify connection details of the server where to execute the script.

C:\Program Files\Devart\dbForge Compare Bundle for MySQL Standard\dbForge Data Compare for MySQL Server>datacompare.com /execute/connection:"Host=JordanSanders;Port=3306;User Id=yourusername;Password=yourpassword;Character Set=utf8"

4. Specify the script file.

C:\Program Files\Devart\dbForge Compare Bundle for MySQL Standard\dbForge Data Compare for MySQL Server>datacompare.com /execute/connection:"Host=JordanSanders;Port=3306;User Id=yourusername;Password=yourpassword;Character Set=utf8" /inputfile:"script.sql"

5. To hide the command-line window, use the /quiet command. (Useful for batch files).

C:\Program Files\Devart\dbForge Compare Bundle for MySQL Standard\dbForge Data Compare for MySQL Server>datacompare.com /execute/connection:"Host=JordanSanders;Port=3306;User Id=yourusername;Password=yourpassword;Character Set=utf8" /inputfile:"script.sql" /quiet

6. Press ENTER to run the process.

If you use the /argfile argument, all the following commands are specified inside an argfile:

/execute
/connection:"Data Source=;Integrated Security=False;User ID=yourusername"
/inputfile:"script.sql" 

In this case, the command-line string will be written as follows:

C:\Program Files\Devart\dbForge Compare Bundle for MySQL Standard\dbForge Data Compare for MySQL Server>datacompare.com /argfile:myarg.txt

Arguments used in the command line

Select corresponding command-line switches to perform the required operations:

Argument Action and Usage
/connection This switch is used to specify a connection string. The command usage looks like: /connection:<connection_string>.
/database This switch allows you to specify a database to execute the script to. Databases specified in the script before will be ignored. It does not affect the objects specified with fully qualified names.
/encoding This switch is used to specify the encoding which should be applied to open and execute the script. The command-line usage looks as follows: /encoding:<encoding>.
/exitcodes The switch is applied to list possible exit codes that can be returned by the command-line process.
/inputfile You can use the switch to specify an SQL or ZIP file with the script to execute.
/password The switch allows specifying a server password. It overrides the password specified in the connection string. The command-line usage looks like: /password:<yourpassword>.
/zippassword This switch is used to enter a password for a protected archive that contains the script. The command-line usage looks as follows: /zippassword:<zip password>.

Want to Find out More?

Overview

Overview

Take a quick tour to learn all about the key benefits delivered by dbForge Data Compare for MySQL.
Request a demo

Request a demo

If you consider employing the Data Compare for your business, request a demo to see it in action.
Ready to start using dbForge Data Compare for MySQL?