Command line
Often you don't want to click at all: automatic backups at fixed times, several drives at once, verification after the backup. Everything the interface can do also works from the command line.
Back up a drive to a file
C:\> SNAPSHOT C: X:\C-Drive.sna backs up drive C: to the file X:\C-Drive.SNA. Several drives, one after another, to a server:
SNAPSHOT C: \\Server\Backups\C-Drive.sna
SNAPSHOT D: \\Server\Backups\D-Drive.sna
SNAPSHOT E: \\Server\Backups\E-Drive.sna If data on different partitions depends on each other, all of them must be backed up at the same time using a shadow copy. To do this, chain the drives with +:
SNAPSHOT C:+D:+E: \\Server\Backups\$disk-Drive.sna Partitions without a drive letter are addressed like this:
- HD1:1
- first partition on the first disk (HD2:1 is the first on the second disk, and so on)
- HD1:*
- all partitions on the first disk
- HD X
- all partitions on the disk where drive X: is located (version 1.43 and later)
- HDWIN:*
- all partitions on the disk from which the running Windows was started
As soon as more than one partition is backed up, $disk must be part of the file name.
Common switches
| -L1490 | Size of a split file in MB. The image is split into .SNA, .SN1, .SN2 … The default is 1490, so that three parts fit on one DVD. Better not go above 4000 MB, otherwise you will run into trouble when restoring under DOS. |
|---|---|
| -R | Empty the drive's Recycle Bin before the backup. |
| -W | Do not wait for a keypress. Without this switch, Snapshot waits at the end if it believes it was started from a batch file. |
| -T | Read and verify the entire image after creating it. An errorlevel > 0 indicates an error. |
| -G | Graphical progress display, even when run from a batch file. -Go exits on success, -Gx always exits, -Gn has no cancel button, -Gm starts minimized. |
File names with date and computer name
Snapshot replaces these placeholders in the file name at startup:
| $computername | Name of the computer |
|---|---|
| $disk | Drive letter (C, D …) |
| $HD | Partition name in the form HD1-1 from 1.43 |
| $type | "dif" for differential images |
| $date | Six-digit date as YYMMDD |
| $weekday | Two-letter day of the week |
| $year $month $day | Four-digit year, month 1–12, day 1–31 |
| $hour $minute $second | Time in 24-hour format |
| $week | Calendar week according to DIN 1355 from 1.43 |
| $LABEL="BACKUP" | the first drive with this label. Handy for USB disks that show up as E: one time and F: the next. |
SNAPSHOT C: $LABEL="Backup"\$computername-$disk-$weekday.snaVerify and repair
C:\> SNAPSHOT X:\Backup\c-drive.sna -T checks an existing image for consistency. In batch files, a separate verification run is usually more practical than -T during the backup: that way you can tell "didn't work because the server was unavailable or the disk was full" apart from "wrote data that is incorrect".
--QuickCheck:test.sna quickly checks whether the image looks complete and error-free. It does not replace the test with -T.
If an image is damaged or parts are missing, it is worthless as a backup, because you never know which parts are affected. If you only need a few files from it, this may help:
C:\> SNAPSHOT X:\DefektesImage.SNA --repair:Y:\REPARIERT.SNA It should be possible to mount the repaired image; after running CHKDSK at the latest, you can access part of the data. There is no guarantee that the content is correct. From version 1.46, --repair X:KAPUTT.SNA appends the repair data to the original instead of creating a new image.
Restore a drive
C:\> SNAPSHOT X:\D-Drive.sna D: writes the image back to drive D:. The same restrictions apply as for a restore via the interface.
| --Schedule C: D:\image.sna | Schedule a restore of D:\image.sna to C: for the next restart. --ListSchedule shows the scheduled restore, --RemoveSchedule removes it. |
|---|---|
| --autoreboot:off|any|success | After a restore during restart: reboot automatically never, always, or only if the run completed without errors. |
| --EntireDisk Image-C.sna HD1 | Restore the entire disk to HD1, with all images created together with Image-C.sna, including the partition structure. from 1.44 |
| --resizepart C: 100000 | Enlarge the partition and file system to 100 GB. Shrinking is not possible. |
| --RestorePartitionStructure HD1 file | MBR, extended partitions and up to the first 63 sectors. Usually sufficient for boot managers as well. |
| --AddDriver | Add a driver for new disks to the restored Windows when moving to different hardware. |
Mount an image as a drive
C:\> SNAPSHOT X:\C-Drive.sna Z: -V turns the image into virtual drive Z: and opens Explorer. -VM only mounts, without Explorer. For batch files there is -VQ without any dialog; Snapshot must then be called with start:
start Snapshot x:\image.sna Z: -vq
xcopy z:\Data c:\Data /E /H /K /O
Snapshot --unmount:Z --unmount without a letter unmounts all mounted images (version 1.38 and later).
Password and exclusions
Specify the password for encryption, restore and mount with -PW=. Otherwise Snapshot prompts for it when mounting and restoring. An empty -PW= creates an unencrypted backup, even if a default password is stored.
C:\> SNAPSHOT C: X:\Backup\c-drive.sna -PW=SuperSecret From version 1.47, the password no longer has to appear in plain text in the batch file. A key file is generated once from the password, and it does not need to be kept secret:
C:\> SNAPSHOT -pwgen=Key.txt -pw=Geheim
C:\> SNAPSHOT C: x:\image-c.sna -pwuse=Key.txt To restore or mount, you then need the original password.
Excluding files
PAGEFILE.SYS and HIBERFIL.SYS are always excluded. Specify additional paths separated by commas; subdirectories are included:
--exclude:\Temp,\Windows\Memory.dmp,\Windows\Minidump\* Technically, only the content of these files is omitted; the directory entries remain. After a restore, the files are therefore present but contain random data. That is why Snapshot places SnapshotDeleteAfterRestore.BAT in the image; you should run it after the restore.
More options
SNAPSHOT --? prints the complete list. A selection:
| --LogFile:C:\LOGFILE.TXT | Redirect all output to a file. |
|---|---|
| --UseVSS --NoVSS --ForceVSS | Use the Windows Volume Shadow Copy service or Snapshot's own driver. |
| --CreateDir | Create the destination directory if it does not exist. |
| --AutoBackupSize:512 | Also back up all partitions under 512 MB on the same disk, for boot and system partitions. from 1.43 |
| --LimitIORate:10 | Limit throughput to 10 MB/s (1–100). |
| --exec:"NET START ORACLE" | Run a command as soon as the snapshot point has been taken. Must be at the end of the command line. |
| --EjectDriveAfterBackup | Eject the destination drive after the backup, if supported. from 1.46 |
| --FullIfHashIsMissing | For a differential backup without a hash file, create a new full image instead. |
| --NetUse:\server\share,N:,user,password | Connect a network drive. from 1.44 |
| --AddFTPAccount:type,user,server,password,port | Create an FTP or SFTP account. Port defaults to 21 or 22, respectively, if not specified. from 1.50 |
| --register:licensefile.txt | Register a license without a dialog. |
| --Version | Print the version number and exit. from 1.47 |
| --show --showlist | List connected disks and partitions. |