Use the Command Line Wizard

Last modified: March 28, 2025

The SQL formatting tool provides a built-in Command Line Wizard that allows converting the formatting options into command-line syntax and saving them as a *.bat file. Later you can use the .bat file to schedule or automate code formatting with a script or any task scheduler tool, for example, Windows Task Scheduler.

You can save command-line file settings as a *.bat file in the Command line execution file settings window. To open the window, click Save Command Line in SQL Formatter Wizard:

Open the Command line execution file settings window

The Command line execution file settings window opens with the following options:

Name Description
Connection Usage: /connection:<connection_string>Specify the connection string.
Password Usage: /password:<pw>Specify the server password. This overrides the password specified in the connection string.
Profile Usage: /profile:<path>|<profile name>Specify the path to the file that contains formatting options settings or a predefined profile name. If the parameter is not specified, default formatting options settings will be applied.
Encoding Usage: /encoding:<codepage>| <encoding name> Specify the encoding which should be applied to open and saved files.
Source File Usage: /sourcefile:<path> Specify the source SQL file that should be formatted.
Output File Usage: /outputfile:<path> Specify the path to the output file where the formatting results of the source file will be saved. Note: In this case, the source file is saved without being changed. If the parameter is not specified, the formatting results will be saved to the source file.
Log file Generate a log file in the specified folder.
Echo OFF Disable echoing all commands in the batch file. All the text in the batch file is enclosed in the @Echo OFF … @Echo ON command.
Keep opened Set a pause command at the end of the batch file text. The command window will be opened.
PowerShell Generate the & symbol at the beginning of the batch file text. This makes the batch file compatible with PowerShell.

To set up the option, click /images/studio-for-postgresql/ Browse next to the corresponding field. After you configure formatting file settings, you can click Validate to verify that the settings are valid. To save the .bat file, click Save. To discard the changes, click Cancel.

Save file settings

If the syntax is valid, the following message is displayed:

Validate code

If any parameter is missing, the following warning is displayed:

Code warning