Automate code formatting from the command line

Last modified: June 23, 2025

dbForge Studio for MySQL allows you to use the command line to format the code.

Note

The command-line interface is available only in the Enterprise and Professional editions of dbForge Studio for MySQL.

How to automate code formatting from the command line

1. Click Start.

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

3. In the window that opens, type cmd and press Enter.

4. Type a path to the dbforgemysql.com file located in the dbForge Studio for MySQL installation folder on your PC.

cd "C:\Program Files\Devart\dbForge Studio for MySQL"

Note

The path to the executable file will differ depending on how you have installed the Studio - as a standalone tool or as part of the dbForge Edge bundle. Ensure you have specified a correct path.

If you have installed the Studio as part of dbForge Edge, change the path accordingly:

cd "C:\Program Files\Devart\dbForge Edge\dbForge Studio for MySQL"

5. Press Enter.

6. Specify the formatting operation–formatsql with the following parameters and arguments:

dbforgemysql.com /formatsql /sourcefile:"D:\NoFormat.sql" /outputfile:"D:\Format.sql"

where:

  • D:\NoFormat.sql is the path to the file you want to format.
  • D:\Format.sql is the path to the formatted results file.

Tip

To get quick help on the arguments available in the command line, run the following:

dbforgemysql.com /formatsql /?

7. Press Enter to run the process.

Note

You can set the unlimited number of the required extensions:

dbforgemysql /formatsql /sourcefolder:"c:\" /filextention:*.sql /filextention:*.prg /filextention:*.db1

Arguments Used in Command Line

Select corresponding command line switches to perform the required operations:

Argument Action to use
/connection Specifies a connection string that contains the parameters to establish a secure connection between the database and server. They usually include the server address, database name, user credentials, and additional options, such as port numbers, timeouts, and encryption settings. The command usage looks like: /connection:<connection_string>
/encoding Specifies the encoding that should be applied to open and save files. The command-line usage looks like: /encoding:<codepage|encoding name>
/errormode Defines the application behavior when an error is encountered. The command usage looks as follows: /errormode:<ignore|abort>
/exitcodes Lists possible exit codes that can be returned by the command-line process.
/filextension Specifies the extension of the source folder files you want to format. The .sql extension is chosen by default. The command usage looks like: /filextension:*.<sql|prc|txt|...>
/includesubfolders Includes the current directory and all subdirectories in a search operation. The command-line usage looks as follows: /includesubfolders
/log Generates a formatting log file in the specified directory. The command usage looks like: /log:<filepath>
/outputfile Specifies the path to an output file where the source folder files with formatting results will be saved. If the parameter is not specified, the formatting results will be saved in the source folder files. The command-line usage looks as follows: /outputfolder:<path>
/outputfolder Defines the path to an output folder where the source folder files with formatting results will be saved. If the parameter is not specified, the formatting results will be saved in the source folder files. The command usage looks like: /outputfolder:<path>
/password Specifies a server password. The command-line usage looks as follows: /password:<pw>
/profile Defines the path to the file that contains formatting settings. If the parameter is not specified, default formatting settings will be applied. The command usage looks like: /profile:<path>
/sourcefile Specifies the path to the files you want to format. The command-line usage looks as follows: /sourcefolder:<path>
/sourcefolder Defines the path to the folder with the files you want to format. The command usage looks like: /sourcefolder:<path>
/treatwarningaserror Decides whether to treat all warnings as errors or to ignore them. The command-line usage looks as follows: /treatWarningAsError:[Yes|No]