Formatting Code through the Command Line

You can automate code formatting using the command line.

Note
The command-line interface is available only in Standard edition of SQLComplete. For detailed information on the features availability in the editions, please refer to the Editions page.

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

  3. Type a path to the sqlcomplete.com file located in the SQL Complete installation folder on your PC, and then press the ENTER key.
    cd "C:\Program Files (x86)\Devart\dbForge SQL Complete"
    
  4. Specify the operation you want to perform (code formatting) and the required parameters and arguments:
     sqlcomplete.com /formatsql /sourcefile:"D:\NoFormat.sql" /outputfile:"D:\Format.sql"
    

    Tip: To see a quick help on the arguments available in the command line, type the following:

    sqlcomplete.com /formatsql /?
    
  5. Press ENTER to run the process.

Arguments Used in 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>
/filextention This switch is used to specify the extension of the source folder files that will be formatted. The .sql extension is selected by default. Command usage looks like:
/filextention:*.<sql|prc|txt|...>
/log This switch is used to generate a formatting log file in the specified directory. Command usage looks like:
/log:<filepath>
/outputfile This switch is used to specify the path to an output file where formatting results of the source file will be saved (in this case, the source file is saved without changing). If the parameter is not specified, the formatting results will be saved in the source file. Command usage looks like:
/outputfile:<path>
/outputfolder This switch is used to specify the patch to an output folder where the source folder files with formatting results will be saved (files form the source folder will no be changed). If the parameter is not specified, the formatting results will be saved in the source folder. Command usage looks like:
/outputfolder:<path>
/password This switch is used to specify a server password. It overrides the password specified in the connection string. Command usage looks like:
/password:<pw>
/profile This switch is used to specify the path to a file that contains settings for formatting options. If the parameter is not specified, the default settings will be applied to the formatting options. Command usage looks like:
/profile:<path>
/sourcefile This switch is used to specify the source SQL file to be formatted. Command usage looks like:
/sourcefile:<path>
/soucefolder This switch is used to specify the path to a folder where the files for formatting are located. Command usage looks like:
/sourcefolder:<path>
/includesubfolders This switch is used to include the current directory and all subdirectories in search operation. Command usage looks like:
/includesubfolders