Formatting Code through the Command Line

You can automate code formatting using the command line.

Note

The command line functionality is available only in certain editions of dbForge Studio. For the detailed information on features availability in the dbForge Studio 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.

    Note

    To run the Command Line in Windows 8 and/or 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.
  3. Type a path to the dbforgemysql.com file located in the dbForge Studio for MySQL installation folder on your PC, and press the SPACE key.
C:\Program Files\Devart\dbForge Studio for MySQL\dbforgemysql.com

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. Make sure that you have specified a correct path. If you have installed the Studio as part of dbForge Edge, change the path accordingly:

C:\Program Files\Devart\dbForge Edge\dbForge Studio for MySQL>dbforgemysql.com
  1. Specify the operation you want to perform (code formatting) and the required parameters and arguments:
dbforgemysql /formatsql [/switch1[:value | [parameter1:value parameter2:value ..]] /switch2 ..]

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

/formatsql /?
  1. Press ENTER to run the process.

Note

You can set the unlimited quantity 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 This switch is used to specify a connection string. The command usage looks like: /connection:<connection_string
/encoding This switch specifies the encoding which should be applied to open and save files. The command-line usage looks like: /encoding:<codepage|encoding name>
/errormode The switch defines the application behavior when an error is encountered. The command usage looks as follows: /errormode:<ignore|abort>
/exitcodes This switch is used to list possible exit codes that can be returned by the command-line process
/filextension The switch specifies the extension of the sourcefolder files that will be formatted. The .sql extension is chosen by default. The command usage looks like: /filextension:*.<sql|prc|txt|...>
/includesubfolders This switch is used to include the current directory and all subdirectories in search operation. The command-line usage looks as follows: /includesubfolders
/log The switch allows generating formatting log file in the specified directory. The command usage looks like: ` /log:`
/outputfile This switch is used to specify the path to an output folder where the sourcefolder files with formatting results will be saved. If the parameter is not specified, the formatting results will be saved in the sourcefolder files. The command-line usage looks as follows: /outputfolder:<path>
/outputfolder The switch is used to define the path to an output folder where the sourcefolder files with formatting results will be saved. If the parameter is not specified, the formatting results will be saved in the sourcefolder files. The command usage looks like: /outputfolder:<path>
/password This switch allows specifying a server password. The command-line usage looks as follows: /password:<pw>
/profile The switch is used to define the path to file that contains formatting options settings. If the parameter is not specified, default formatting options settings will be applied. The command usage looks like: /profile:<path>
/sourcefile This switch specifies the path to folder where the files for formatting are located. The command-line usage looks as follows: /sourcefolder:<path>
/sourcefolder The switch allows defining the path to folder where the files for formatting are located. The command usage looks like: /sourcefolder:<path>
/treatwarningaserror This switch allows you to decide whether to treat all warnings as errors or to ignore them. The command-line usage looks as follows: /treatWarningAsError:[Yes|No]

Want to Find out More?

Overview

Overview

Take a quick tour to learn all about the key benefits delivered by dbForge Studio for MySQL.
All Features

All features

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

Request a demo

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