How to run a backup using batch file
Introduction
You can start backup manually using a specially created batch file.
Solution
Make sure that the component Command-Line Tool is installed on the machine: the default location is \Program Files\Acronis\CommandLineTool\acrocmd.exe
You can either run a backup plan that was created from Management Console or create a script from scratch.
Run existing backup plan
1. Find out task id for the backup plan:
- On the machine where backup plan is applied, launch Command Prompt (Win+R -> cmd) and run the following command: acrocmd list tasks --output=raw
(for ease of use you can write output to a file, e.g. acrocmd list tasks --output=raw >D:\tasklist.txt ) - Output of the command will contain the following values for the existing tasks: Name, State, Last Result, Last Start, Last Finish, User, GUID, Plan UID, Plan name.
- Identify the necessary plan using the task name and/or Plan name and get the ID from GUID value for that plan:
2. Create a new .txt file with the following contents:
acrocmd run task --id=<XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX>
Where XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX is the the task id, identified at previous step, e.g. acrocmd run task --id=69BFE35A-3CB9-4705-857E-0BA950F45CA2
3. Save the file and change its extension to .bat
Now you can start the backup by double-clicking the created batch file.
Results of the backup launched this way will be displayed in the list of activities same as for backup launched via GUI.
Run backup via command line.
If you do not have a backup plan, you can create a script to run backup without task id. You can find more details and usage examples in Command Line reference.
Create a new .txt file and specify the backup command in the following format:
- Command for backing up select volumes :
acrocmd backup disk --volume=X,X --loc="<backup location>"
e.g. acrocmd backup disk --volume=2-1,1-3 --loc="F:\my backups"
- Command for backing up files
acrocmd backup file --include=<file_or_folder> --loc=<backup_location> --arc=<archive_name>
e.g. acrocmd backup file --include=D:\documents --loc=E:\backups\ --arc=docs_backup
Save the file and change its extension to .bat. Run the task by double-clicking the created batch file.