Template for File Backups

Top  Previous  Next

REM DOS script to automate backup using ntbackup.exe to a file

 

REM Create filename based on date

for /f "Tokens=1-4 Delims=/ " %%i in ('date /t') do  set DT=%%i-%%j-%%k-%%l

for /f "Tokens=1" %%i in ('time /t') do set TM=-%%i

 

set TM=%TM::=-%

set DTT=%DT%%TM%

set FILENAME=[BACKUP_DESTINATION]%DTT%.bkf

 

REM Execute Backup

%SYSTEMROOT%\system32\NTBACKUP.EXE backup "@[BACKUP_FILE]" /n "%DTT%" /d "%DTT%" /v:no /r:no /rs:no /hc:on /m normal /j "%DTT%" /l:f /f "%FILENAME%" /um