Note that this feature may added to other tools not listed above
This article explains all about the Save project as batch file feature
Most ApexSQL tools have a CLI switch to consume a project file. This allows for the simplicity and ease of using a project file but also for unattended automation of a batch file. A batch file can be manually initiated simply by double-clicking or it can be scheduled via SQL Server job, PowerShell project, etc., as a part of automating process.
But some users prefer the transparency and full granular control of explicitly setting all of the switches directly using the CLI, without using the project file to import switch values. That is where the Save project as batch file serves a purpose. Save project as batch file is a feature that allows creating batch files, automatically, based on the selected settings in the application GUI.
Depending on the application, the Save project as batch file feature is located in the final wizard as in the following examples:
ApexSQL Data Diff – Synchronization wizard
ApexSQL Log – Output wizard
ApexSQL Script – Script wizard
It can be also located, under the Save button, from the Home tab in the main application window for as shown in this example with ApexSQL Generate:
Once the feature is initiated, the Save project as batch file window will be shown and all previously set options will be expressed thorough their corresponding CLI switches:
Additionally, instead of having an individual CLI switch for each option, the Project file option can be checked and saved, and it will replace all CLI switches, except for the output and additional option switches:
All mentioned applications have an option to set different output types e.g. a synchronization SQL script, reports, or executable package . Output types are located on the top of the Save project as batch window:
Each output type has the Browse or Settings button next to it, which can be used to set the output type’s location or some additional options, as an individual CLI switch in a batch script.
For example, a Sync script is set as the primary output type, the Browse button is clicked and a path is provided. CSV is used as the secondary output type, the Settings button is clicked and the below options are checked:
Once the desired export options are set and the OK button is clicked, the Browse for folder window will appear and it will allow to set the CSV folder location:
After saving the folder location, all previously set options will be shown in the batch script:
All additional options that are part of the CLI, such as verbose mode, can be added to a batch script simply by checking them in the Save project as batch file window.
Explanation of additional options:
Redirect console output to file – console output can be redirected to a file in specified location
Logging – all changes during the application’s usage will be written to a log file
Test mode – outputs parsed CLI switches to test if all switches are set properly, without taking any actions
Verbose – shows all messages about processed action
Force – overwrites an existing output file(s) with the same name
Disable echo – turns the echoing option on or off, or displays a message
Return error code – provides one of the return codes upon the batch file execution
After going through all the options and setting everything up, click the Save button
Q: Can I save the project file without closing the Save project as batch file window?
A: Yes. If any change is made during the editing of the existing project, it can be saved with a click on the Save button next to the project file field:
Q: Is it possible to override some options that are “hard-coded” in a project file?
A: Yes. By adding a CLI switch that is already covered with some option in a project file, a CLI switch will override the option set in a project file.