Automate data generation script execution
Last modified: April 3, 2025
Automating the execution of data generation scripts allows you to streamline your workflows and run tasks without manual intervention. By using the command-line interface (CLI) in dbForge Studio, you can schedule or execute scripts automatically, making it easier to integrate data generation into batch processes or automation systems.
Execute the script automatically
1. Start Windows Command Prompt (CMD).
Note
To run the Command Line in Windows 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.
2. Type a path to the dbforgepostgresql.com file located in the dbForge Studio for PostgreSQL installation folder on your PC, and then press the SPACE key.
C:\Program Files\Devart\dbForge Studio for PostgreSQL\dbforgepostgresql.com
3. To execute the script, use the /execute
command, and then press the SPACE key.
C:\Program Files\Devart\dbForge Studio for PostgreSQL>dbforgepostgresql.com /execute /?
4. Specify the connection details of the server on which you want to execute the script.
C:\Program Files\Devart\dbForge Studio for PostgreSQL>dbforgepostgresql.com /execute/connection:"User Id=yourusername;Host=host_name;Port=port_number;Database=database_name;Unicode=True;Connection Timeout=connect_timeout;Integrated Security=False"
5. Specify the script file.
C:\Program Files\Devart\dbForge Studio for PostgreSQL>dbforgepostgresql.com /execute/connection:"User Id=yourusername;Host=host_name;Port=port_number;Database=database_name;Unicode=True;Connection Timeout=connect_timeout;Integrated Security=False" /inputfile:"script_filename.sql"
6. Specify the password.
C:\Program Files\Devart\dbForge Studio for PostgreSQL>dbforgepostgresql.com /execute/connection:"User Id=yourusername;Host=host_name;Port=port_number;Database=database_name;Unicode=True;Connection Timeout=connect_timeout;Integrated Security=False" /inputfile:"script_filename.sql"/Password:yourpassword
7. To hide the command-line window, use the /quiet command. (Useful for batch files).
C:\Program Files\Devart\dbForge Studio for PostgreSQL>dbforgepostgresql.com /execute/connection:"User Id=yourusername;Host=host_name;Port=port_number;Database=database_name;Unicode=True;Connection Timeout=connect_timeout;Integrated Security=False" /inputfile:"script_filename.sql"/Password:yourpassword /quiet
8. Press ENTER to run the process.
Switches used in the command line
Switch | Usage |
---|---|
/activate |
Activate the product using the activation key. |
/deactivate |
Deactivate the product. |
/execute |
Execute a script. |
/generatedata |
Generate data with a given project file. |
/script |
Script a database. |
/quiet (/q) |
Hide the console window in the console mode. It should be used after the main operation switch. |
/execute
Execute script.
Parameter | Description |
---|---|
connection |
Specify the connection string: /connection:<connection_string> |
database |
Specify a database to script or override the database specified in a template or in a connection string |
encoding |
Specify the encoding which should be applied to open and execute the script: /encoding:<codepage\|encoding name> |
inputfile |
Specify an SQL or ZIP file with a script to execute. |
password |
Specify the server password or override the password specified in the connection string: /password:<yourpassword> |
zippassword |
Enter a password for protected archive with script: /zippassword:<zip password> |
/generatedata
Generate data with a given project file.
Parameter | Description |
---|---|
connection |
Specify the connection string: /connection:<connection_string> |
errormode |
Specify the application behavior when an error is encountered: /errormode:<ignore/abort> |
password |
Specify the server password or override the password specified in the connection string. |
projectfile |
Specify a data generation template to use: /projectfile:<path> |
/script
Script a database.
Parameter | Description |
---|---|
connection |
Specify the connection string: /connection:<connection_string> |
database |
Specify a database to script or override the database specified in a template or in a connection string |
outputfile |
Specify a file name for storing the database script or override the file name specified in template |
password |
Specify the server password or override the password specified in the connection string: /password:<yourpassword> |
projectfile |
Specify a script template to use. Some template options can be overridden by switches: /projectfile:<path> |
Exit codes used in the command line
Code | Description | Additional information |
---|---|---|
0 | Success | The operation has been completed without errors. |
2 | Ctrl+Break | Execution stopped because of Ctrl+Break. |
10 | Command-line usage error | The command line was used incorrectly. For example, an incorrect flag, or incorrect syntax may have been used. |
11 | Illegal argument duplication | Some arguments may not appear more than once in a command line. For example, /arg2 depends on /arg1 but you have specified /arg2 without specifying /arg1, or /arg2 cannot be used with /arg1, but you have used them both. |
20 | Trial expired | Software trial period has expired, or the product has not been activated. |
40 | Server connection fail | Server connection failed. |
103 | Script executed with errors | The script was executed with errors. |
105 | Resource unavailable | The file is missing. |
108 | No objects | There are no objects to perform the specified operation. |
Want to find out more?
Overview
Take a quick tour to learn all about the key benefits delivered by dbForge Studio for PostgreSQL.
All features
Get acquainted with the rich features and capabilities of the tool in less than 5 minutes.
Request a demo
If you consider employing this tool for your business, request a demo to see it in action.