Pre and Post commands enable the users to perform specific tasks before and after the backup run. You can activate the use of these commands from the Settings page of any backup job; (i.e. step 4 of the backup job creating process)

With these commands, the user is able to perform the following:

– Check Disk drives (chkdsk)

Chkdsk lists and corrects errors on the disk.

The general form of the chkdsk command is:

chkdsk volume: path\ filename /f

For example, if you want to check drive D and have windows fix any errors on it, type:

chkdsk d:\ /f

chkdsk cannot function on a locked files used by other programs.

Path and filename are optional, chkdsk can be performed on a drive.

/f is used to enable windows to fix the errors on the drive and can be omitted.

 

– Copy files (copy)

Copy copies one or more file to a destination.

The general form of the copy command is:

copy Source + Source + ... Destination

For example, if you want to copy contact.txt and info.doc that are on your D: drive to the Desktop, type:

copy "d:\contact.txt" + "d:\info.doc" "C:\Users\%username\Desktop\"

If you want to copy the log file to drive C: you can write:

copy "$LOGFILE$" "c:\"

copy command can only copy files and cannot copy files with 0 KB size, use xcopy to perform that task.

 

– Copy files and folders (xcopy)

Xcopy copies files and folders in the source to the destination.

The general form of the xcopy command is:

xcopy Source Destination

For example, if you want to copy the content of a folder named Backups on the C: drive to the Desktop, type:

Xcopy "c:\Backups" "C:\Users\%username\Desktop\"

 

– Defragment a drive (defrag)

Locates and consolidates fragmented boot files, data files, and folders on local volumes.

For example, if you want to defragment the C drive, type:

defrag c:

You cannot defragment volumes that the file system has marked as dirty, which indicates possible corruption. You must run chkdsk on a dirty volume before you can defragment it.

 

– Disk copy removable disks (diskcopy)

This command is used to copy the contents of the floppy disk in the source drive to a formatted or unformatted floppy disk in the destination drive.

For example, if you want to copy the floppy in drive A to the floppy in drive B type:

diskcopy a: b:

 

– Move files (move)

This command is used to move one or more than one file to a specified directory.

For example, if you want to move the main backup file/folder to the C drive type:

move “$BACKUPOUTPUT$” c:\

 

– Replace files (replace)

replace command replaces files in the destination directory with files in the source directory that have the same name. You can also use replace to add unique file names to the destination directory.

For example, if you want to replace a file named Backup.txt in the C drive with the Backup.txt on the desktop, type the following:

replace “C:\Documents and Settings\%username\Desktop\backup.txt” C:\

 

– Shutdown, log off or restart the computer (shutdown)

This command is used to shutdown, log off, or restart the local computer or remote computer.

To shutdown the computer type:

shutdown -s -f –m \\computername

To log off the computer type:

shutdown -l -f -m \\computername

To restart the computer type:

shutdown -r -f -m \\computername

To shutdown, log off, or restart from the local computer omit the “–m \\computername” part from the commands above.

To delay the shutdown procedure in order for the user to abort shutdown, you can proceed with the following steps:

  1. In the post command, type:
    shutdown -s –t XX

    Where XX is the number of seconds to delay the shutdown.

  2. To abort during shutdown please follow these steps:
    1. From start → Run → Type cmd.exe and hit Enter. A command prompt window will appear.
    2. Type the following command:
      shutdown –a

      This will abort the shutdown while in process.