I am using Drive Snaphot with scripts, and have found it to be very reliable. The help page here has a "Date" command line string, but I cannot see a "Time" string. A "Time" string would make it very simple to be able to do more than one backup in a day. Is it just that the help page hasn't been updated, or isn't there a "Time" string? Below is what I found on the website.
Hadron, you could adapt this... Code: @echo off CD /d %~dp0 set hh=%time:~0,2% if "%time:~0,1%"==" " set hh=0%hh:~1,1% set timestamp=%time:~0,8% if @%timestamp:~0,1% == @ set timestamp=0%timestamp:~1,7% set timestamp=%date:.=%_%timestamp::=% echo.Timestamp :: %timestamp% ren hadron-C.sna hadron-C-%timestamp%.sna The output is (time = hhmmss)... hadron-C-2019-Nov-11_181335.sna
Hi Brian. I currently use this. Code: @echo off CD /d %~dp0 if not defined RunTask set RunTask=1 & start "Snapshot" /min %SystemRoot%\system32\cmd.exe /c "%0" & goto :EOF snapshot64.exe HD1:* "D:\System_Backup\Drive_Snapshot\$DISK-$DATE.sna" -o -L0 --UseVSS exit Would this work? Code: @echo off CD /d %~dp0 if not defined RunTask set RunTask=1 & start "Snapshot" /min %SystemRoot%\system32\cmd.exe /c "%0" & goto :EOF snapshot64.exe HD1:* "D:\System_Backup\Drive_Snapshot\$DISK-$DATE-$TIME.sna" -o -L0 --UseVSS exit Also, what is HD1:* denoting?
$TIME isn't a DS variable. HD1:* is an Entire Disk backup for DS HD1. Change $DISK-$DATE-$TIME.sna to EntireHD1.sna Code: @echo off CD /d %~dp0 if not defined RunTask set RunTask=1 & start "Snapshot" /min %SystemRoot%\system32\cmd.exe /c "%0" & goto :EOF snapshot64.exe HD1:* "D:\System_Backup\Drive_Snapshot\EntireHD1.sna" -o -L0 --UseVSS CD /d D:\System_Backup\Drive_Snapshot set hh=%time:~0,2% if "%time:~0,1%"==" " set hh=0%hh:~1,1% set timestamp=%time:~0,8% if @%timestamp:~0,1% == @ set timestamp=0%timestamp:~1,7% set timestamp=%date:.=%_%timestamp::=% echo.Timestamp :: %timestamp% ren EntireHD1.sna EntireHD1-%timestamp%.sna In Control Panel, Region, must have yyyy-MMM-dd, not yyyy/MMM/dd for the Short date. Edit... added... CD /d D:\System_Backup\Drive_Snapshot
Thanks for the reply, Brian. OK. Regarding HD1:*, I was looking at my SSD in Diskpart. I couldn't remember about that. Regarding adding the time, is that my only option?
The script works fine. Just tested it. Let me know if you see a "press any key". Your file will be... EntireHD1-2019-Nov-11_181335.sna
Apologies. I was testing partition backups and you want Disk backups. How many partitions are on your DS HD1?
This should work for DS HD1 Code: @echo off CD /d %~dp0 if not defined RunTask set RunTask=1 & start "Snapshot" /min %SystemRoot%\system32\cmd.exe /c "%0" & goto :EOF snapshot64.exe HD1:* "D:\System_Backup\Drive_Snapshot\$DISK.sna" -o -L0 --UseVSS -W CD /d D:\System_Backup\Drive_Snapshot :: +++++++++ Move all .sna to another folder +++++++++ set hh=%time:~0,2% if "%time:~0,1%"==" " set hh=0%hh:~1,1% set timestamp=%time:~0,8% if @%timestamp:~0,1% == @ set timestamp=0%timestamp:~1,7% set timestamp=%date:.=%_%timestamp::=% echo.Timestamp :: %timestamp% MD %timestamp% MOVE *.sna %timestamp% exit
Thanks. I used a similar script several months ago on my test computer. The DS backups go to a date/time folder. Worked fine. As you have found, Windows Disk 0 is DS HD1.
You can change it back later if you don't like the script but you must have - and not / Any date format should be OK... dd-MM-yy dd-MMM-yy dd-MMMM-yy yyyy-MM-dd yyyy-MMM-dd Try this test before you create the image. In D:\System_Backup\Drive_Snapshot create a New Text Document and rename it test.sna (the .txt extension will be removed). So you have a pretend .sna. Run this batch file (as an Admin)... Code: CD /d D:\System_Backup\Drive_Snapshot :: +++++++++ Move all .sna to another folder +++++++++ set hh=%time:~0,2% if "%time:~0,1%"==" " set hh=0%hh:~1,1% set timestamp=%time:~0,8% if @%timestamp:~0,1% == @ set timestamp=0%timestamp:~1,7% set timestamp=%date:.=%_%timestamp::=% echo.Timestamp :: %timestamp% MD %timestamp% MOVE *.sna %timestamp% exit It should create a date/time folder and move test.sna into the folder. If you have other .sna in D:\System_Backup\Drive_Snapshot move them into a sub folder before creating test.sna.
Excellent. I like it because each backup will be in its own folder and you don't have to be concerned about each backup having the same name.
Is there a way to get Drive Snapshot to automatically remove / delete / purge images after a defined number?
Easy to do if all images are created as hadron.sna This script saves the 3 most recent files... Code: IF EXIST c_C.sna (DEL c_C.sna) IF EXIST c_B.sna (REN c_B.sna c_C.sna) IF EXIST c_A.sna (REN c_A.sna c_B.sna) REN hadron.sna c_A.sna
Thanks for the reply, Brian. I am currently using this script. Code: @echo off CD /d %~dp0 if not defined RunTask set RunTask=1 & start "Snapshot" /min %SystemRoot%\system32\cmd.exe /c "%0" & goto :EOF snapshot64.exe HD1:* "D:\System_Backup\Drive_Snapshot\$DISK-$DATE.sna" -o -L0 --UseVSS exit How can I implement your code into that?
Yes, on this computer, it produces 3 SNA files. But Snapshot produces an SNA file for each partition. I have Snaphot running on 2 other computers, and it produces 5 SNA files on another desktop, and 4 SNA files on a notebook. PS: I always backup entire system drive.
OK. I keep forgetting these are Entire Drive images. My batch file above won't help. I can't think of an auto method to control sna numbers. Try this for new switches. You should be delighted. snapshot64.exe /?
I thought you would like... $hour is substituted with the hour $minute is substituted with the minute $second is substituted with the second