Automate script execution

You can automate script execution from the command line.

Click Start.

1. Type cmd in the Search programs and files text box and press the ENTER button.

Note

To run the Command Line in Windows 8:

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 then 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.

With Windows + R shortcut keys

  • In desktop mode, press the Windows + R keys, to show the Run command line.

2. Type a path to the schemacompare.com file located in the dbForge Schema Compare for SQL Server installation folder on your PC, and then press the SPACE key.

C:\Program Files\Devart\dbForge Schema Compare for SQL Server\schemacompare.com

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

"C:\Program Files\Devart\Compare Bundle for SQL Server\dbForge Schema Compare for SQL Server/schemacompare.com" /execute /?

Note

The path to the executable file will differ depending on which tools suite you have installed Schema Compare with - Compare Bundle or SQL Tools. Make sure that you have specified a correct path. If you have installed Schema Compare as part of SQL Tools, change the path accordingly:

C:\Program Files\Devart\dbForge SQL Tools Professional\dbForge Schema Compare for SQL Server\schemacompare.com

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

"C:\Program Files\Devart\Compare Bundle for SQL Server\dbForge Schema Compare for SQL Server\schemacompare.com" /execute
/connection:"Data Source=DBMSSQL\MSSQL2012;Integrated Security=False;User ID=yourusername" 

5. Specify the script file.

"C:\Program Files\Devart\Compare Bundle for SQL Server\dbForge Schema Compare for SQL Server\schemacompare.com" /execute 
/connection:"Data Source=DBMSSQL\MSSQL2012;Integrated Security=False;User ID=yourusername" /inputfile:"script.sql"

6. Specify the password.

"C:\Program Files\Devart\Compare Bundle for SQL Server\dbForge Schema Compare for SQL Server\schemacompare.com" /execute 
/connection:"Data Source=DBMSSQL\MSSQL2012;Integrated Security=False;User ID=yourusername" /inputfile:"script.sql" 
/Password:yourpassword

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

"C:\Program Files\Devart\Compare Bundle for SQL Server\dbForge Schema Compare for SQL Server\schemacompare.com" /execute 
/connection:"Data Source=DBMSSQL\MSSQL2012;Integrated Security=False;User ID=yourusername" /inputfile:"script.sql" 
/Password:yourpassword /quiet

8. 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=DBMSSQL\MSSQL2012;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\Compare Bundle for SQL Server\dbForge Schema Compare for SQL Server\schemacompare.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. Command usage looks like:
/connection:<connection_string>
/database This switch is used 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.
/inputfile This switch is used to specify an SQL or ZIP file with the script to execute.
/password This switch is used to specify a server password. It overrides the password specified in the connection string. Command line usage looks like:
/password:<pw>
/encoding This switch is used to specify the encoding which should be applied to open and execute the script. Command line usage looks like:
/encoding:<encoding>

See also: How to set up email delivery for schema comparison logs

Want to Find out More?

Overview

Overview

Take a quick tour to learn all about the key benefits delivered by dbForge Schema Compare for SQL Server.
All Features

All features

Get acquainted with the rich features and capabilities of the Schema Compare in less than 5 minutes.
Request a demo

Request a demo

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