Pre-job and post-job commands
The Batch tab can run commands before or after a job. This is an advanced administration feature for coordinating maintenance with other software.
Understand the execution account
The O&O Defrag Agent executes these commands under the local SYSTEM account, which has extensive privileges on the computer. It is not your interactive Windows account. User-specific mapped drives, credentials, profile files, and desktop prompts may be unavailable.
Only use commands you have reviewed and tested for that context. Do not paste an unfamiliar script into a job.
Add commands
- Open the job for editing and select Batch.
- Enable Pre-job execution or Post-job execution.
- Read and confirm the privilege warning.
- Enter the required commands, or choose Import… to load a batch or text file.
- Review the full text and save the job.
Import replaces the current command text. Copy anything you want to retain before importing. The editor limits the command text to 20,480 characters.
Pre-job behavior
Use pre-job commands for required preparation. If a pre-job command fails, optimization will not start. Ensure scripts return meaningful success and failure results, and handle their own errors explicitly.
Avoid commands that require a person to respond to a window. Use explicit, quoted paths and account for the service account's access to files.
Post-job behavior
Use post-job commands for work that should follow the task. Do not confuse them with the shutdown/restart choice on the Schedule tab.
If a command changes another application's state, plan and test the recovery path for an interrupted or failed maintenance run. Do not assume an unfinished job will restore an application's state automatically.
Verify
Test the job during an attended maintenance window. Review its reports and relevant application logs before relying on it unattended. Disable the corresponding Enable box to stop future pre- or post-job command execution while retaining the saved text.