@if "%debug%" == "" echo off @if not "%debug%" == "" echo on :: $Id$ :: Copyright (c) 2002-2006, Ross Smith. All Rights Reserved. verify other 2>nul setlocal enableextensions setlocal enabledelayedexpansion ::pushd ::cd /d "%~dp0" ::echo %path% | find /i "%~dp0" >nul ::if errorlevel 1 path=%PATH%;%~dp0 set _bucompress=none set _bucompressionlevel= set _budate= set _buexcludes= set _bufilename= set _bulabel= set _bumaxsize= set _bumethod=rar set _buoptions= :: source parameters, may contain single letters :: rename to sources set _buparams= set _bupassword= set _busysdir= set _busystem=%COMPUTERNAME% set _butime= set _butype=full set _buunique= set _bushutdown= :: "c:\path\to\file\" or "\path\to\file\" or "path\to\file\" :: relative\path\ or c:\absolute\path\ set _bu_path= :: "%computername%_backup-type_yy-mm-dd_hh-mm-ss" set _bu_file= :: ext: rar|bkf|zip set _bu_ext= :: "%computername%_backup-type_yy-mm-dd_hh-mm-ss.rar" set _bu_file_ext= :: "c:\path\to\file\%computername%_backup-type_yy-mm-dd_hh-mm-ss" set _bu_fullpath= :: "c:\path\to\file\%computername%_backup-type_yy-mm-dd_hh-mm-ss.rar" set _bu_fullpath_ext= :: source parameters, single letters map to drive specs (c => c:\, etc) set _bupaths= :: "short" name for backup type: full, diff, incr, copy, set _butyp= call :get_date set _buyymmdd=%_rv% call :get_time set _buhhmmss=%_rv% :get_next_option if /i "%~1" EQU "/?" goto syntax if /i "%~1" EQU "-?" goto syntax if /i "%~1" EQU "/h" goto syntax if /i "%~1" EQU "-h" goto syntax if /i "%~1" EQU "/help" goto syntax if /i "%~1" EQU "--help" goto syntax if /i "%~1" EQU "/b" goto method if /i "%~1" EQU "-b" goto method if /i "%~1" EQU "/method" goto method if /i "%~1" EQU "--method" goto method if /i "%~1" EQU "/c" goto compress if /i "%~1" EQU "-c" goto compress if /i "%~1" EQU "/compress" goto compress if /i "%~1" EQU "--compress" goto compress if /i "%~1" EQU "/d" goto date if /i "%~1" EQU "-d" goto date if /i "%~1" EQU "/date" goto date if /i "%~1" EQU "--date" goto date if /i "%~1" EQU "/f" goto filename if /i "%~1" EQU "-f" goto filename if /i "%~1" EQU "/filename" goto filename if /i "%~1" EQU "--filename" goto filename if /i "%~1" EQU "/i" goto time if /i "%~1" EQU "-i" goto time if /i "%~1" EQU "/time" goto time if /i "%~1" EQU "--time" goto time if /i "%~1" EQU "/l" goto label if /i "%~1" EQU "-l" goto label if /i "%~1" EQU "/label" goto label if /i "%~1" EQU "--label" goto label if /i "%~1" EQU "/m" goto compressionlevel if /i "%~1" EQU "-m" goto compressionlevel if /i "%~1" EQU "/compressionlevel" goto compressionlevel if /i "%~1" EQU "--compressionlevel" goto compressionlevel if /i "%~1" EQU "/o" goto option if /i "%~1" EQU "-o" goto option if /i "%~1" EQU "/option" goto option if /i "%~1" EQU "--option" goto option if /i "%~1" EQU "/p" goto password if /i "%~1" EQU "-p" goto password if /i "%~1" EQU "/password" goto password if /i "%~1" EQU "--password" goto password if /i "%~1" EQU "/s" goto system if /i "%~1" EQU "-s" goto system if /i "%~1" EQU "/system" goto system if /i "%~1" EQU "--system" goto system if /i "%~1" EQU "/t" goto type if /i "%~1" EQU "-t" goto type if /i "%~1" EQU "/type" goto type if /i "%~1" EQU "--type" goto type if /i "%~1" EQU "/v" goto maxsize if /i "%~1" EQU "-v" goto maxsize if /i "%~1" EQU "/maxsize" goto maxsize if /i "%~1" EQU "--maxsize" goto maxsize if /i "%~1" EQU "/u" goto unique if /i "%~1" EQU "-u" goto unique if /i "%~1" EQU "/unqiue" goto unique if /i "%~1" EQU "--unique" goto unique if /i "%~1" EQU "/x" goto exclude if /i "%~1" EQU "-x" goto exclude if /i "%~1" EQU "/exclude" goto exclude if /i "%~1" EQU "--exclude" goto exclude if /i "%~1" EQU "/y" goto sysdir if /i "%~1" EQU "-y" goto sysdir if /i "%~1" EQU "/sysdir" goto sysdir if /i "%~1" EQU "--sysdir" goto sysdir if /i "%~1" EQU "/z" goto shutdown if /i "%~1" EQU "-z" goto shutdown if /i "%~1" EQU "/shutdown" goto shutdown if /i "%~1" EQU "--shutdown" goto shutdown goto no_more_options :compress shift set _bucompress=%~1 shift goto get_next_option :compressionlevel shift set _bucompressionlevel=%~1 shift goto get_next_option :date shift set _budate=Y set _bu_path=%_bu_path%%_buyymmdd%\ goto get_next_option :exclude shift set _buexcludes=%_buexcludes% %1 shift goto get_next_option :filename shift set _bufilename="%~1" set _buunique= shift goto get_next_option :label shift set _bulabel=%~1 shift goto get_next_option :maxsize shift set _bumaxsize=%~1 shift goto get_next_option :method shift set _bumethod=%~1 shift goto get_next_option :option shift set _buoptions=%_buoptions% %1 shift goto get_next_option :password shift set _bupassword=%1 shift goto get_next_option :shutdown shift set _bushutdown=1 shift goto get_next_option :sysdir shift set _busysdir=Y set _bu_path=%_bu_path%%_busystem%\ goto get_next_option :system shift set _busystem=%~1 shift goto get_next_option :time shift set _butime=Y set _bu_path=%_bu_path%%_buhhmmss%\ goto get_next_option :type shift set _butype=%1 shift goto get_next_option :unique shift set _buunique=1 set _bufilename= goto get_next_option :no_more_options set _buparams= set _lastparam= :get_next_param if "%~1" == "" goto no_more_params set _buparams=%_buparams% %_lastparam% set _lastparam="%~1" shift goto get_next_param :no_more_params call :unquote %_lastparam% if "%_rv%" == "" goto syntax if /i "%_bumethod%" == "winrar" set _bumethod=rar if /i "%_bumethod%" == "winzip" set _bumethod=zip if /i "%_bumethod%" == "ntbackup" goto method_ok if /i "%_bumethod%" == "rar" goto method_ok if /i "%_bumethod%" == "zip" goto method_ok echo Error: Unknown backup method: "%_bumethod%" goto :eof :method_ok set _bu_ext=%_bumethod% if /i "%_bumethod%" == "ntbackup" set _bu_ext=bkf if /i "%_bucompress%" == "winrar" set _bucompress=rar if /i "%_bucompress%" == "winzip" set _bucompress=zip if /i "%_bucompress%" == "rar" goto compress_ok if /i "%_bucompress%" == "zip" goto compress_ok if /i "%_bucompress%" == "none" goto compress_ok echo Error: Unknown compression method: "%_bucompress%" goto :eof :compress_ok if /i "%_butype%" == "normal" set _butype=full if /i "%_butype%" == "incr" set _butype=incremental if /i "%_butype%" == "diff" set _butype=differential set _butyp=%_butype:~0,4% if /i "%_butype%" == "full" set _butype=normal if /i "%_butype%" == "copy" goto type_ok if /i "%_butype%" == "normal" goto type_ok if /i "%_butype%" == "differential" goto type_ok if /i "%_butype%" == "incremental" goto type_ok echo Error: Unknown backup type: "%_butype%" goto :eof :type_ok call :unquote %_lastparam% set _butemp=%_rv% set _lastparam= :: get the last character of the last parameters set _butemp2=%_butemp:~-1% :: if it's not a \, add a \ if not "%_butemp2%" == "\" set _butemp=%_butemp%\ set _bu_path="%_butemp%%_bu_path%" set _butemp= set _butemp2= if not exist %_bu_path% mkdir %_bu_path% if not exist %_bu_path% ( echo Error: Can't create directory %_bu_path% goto :eof ) if not "%_buunique%" == "" goto file_unique if not "%_bufilename%" == "" goto file_filename :: %computername%_backup-type_yy-mm-dd_hh-mm-ss set _bu_file="%_busystem%_%_butyp%_%_buyymmdd%_%_buhhmmss%" call :unquote %_bu_path% set _bu_fullpath=%_rv% call :unquote %_bu_file% set _bu_fullpath_ext="%_bu_fullpath%%_rv%.%_bu_ext%" set _bu_fullpath="%_bu_fullpath%%_rv%" goto not_unique :file_filename set _bu_file=%_bufilename% call :unquote %_bu_path% set _bu_fullpath=%_rv% call :unquote %_bu_file% set _bu_fullpath_ext="%_bu_fullpath%%_rv%.%_bu_ext%" set _bu_fullpath="%_bu_fullpath%%_rv%" goto not_unique :file_unique set id=1 :next_unique set _bu_file="%id%" call :unquote %_bu_path% set _bu_fullpath=%_rv% call :unquote %_bu_file% set _bu_fullpath_ext="%_bu_fullpath%%_rv%.%_bu_ext%" set _bu_fullpath="%_bu_fullpath%%_rv%" if not exist %_bu_fullpath_ext% goto not_unique set /a id=%id% + 1 >nul 2>nul goto next_unique :not_unique call :unquote %_bu_file% set _bu_file_ext="%_rv%.%_bu_ext%" set _bu_fixed_paths= for %%i in (%_buparams%) do ( call :map_single_letter_to_drive %%i if not "!_rv!" == "systemstate" set _rv="!_rv!" set _bu_fixed_paths=!_bu_fixed_paths! !_rv! ) set _bupaths= for %%i in (%_buparams%) do ( call :unquote %%i if not "!_rv!" == "systemstate" set _rv="!_rv!" set _bupaths=!_bupaths! !_rv! ) echo _bucompress =%_bucompress% echo _bucompressionlevel=%_bucompressionlevel% echo _budate =%_budate% echo _buexcludes =%_buexcludes% echo _bufilename =%_bufilename% echo _bulabel =%_bulabel% echo _bumaxsize =%_bumaxsize% echo _bumethod =%_bumethod% echo _buoptions =%_buoptions% echo _buparams =%_buparams% echo _bupassword =%_bupassword% echo _bushutdown =%_bushutdown% echo _busysdir =%_busysdir% echo _busystem =%_busystem% echo _butime =%_butime% echo _butype =%_butype% echo _buunique =%_buunique% echo _bu_drive =%_bu_drive% echo _bu_path =%_bu_path% echo _bu_file =%_bu_file% echo _bu_ext =%_bu_ext% echo _bu_file_ext =%_bu_file_ext% echo _bu_fullpath =%_bu_fullpath% echo _bu_fullpath_ext =%_bu_fullpath_ext% echo _buhhmmss =%_buhhmmss% echo _bu_fixed_paths =%_bu_fixed_paths% echo _bupaths =%_bupaths% echo _butyp =%_butyp% echo _buyymmdd =%_buyymmdd% goto method_%_bumethod% echo Error: Unknown backup method '%_bumethod%' goto :eof ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :method_ntbackup ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: set _bulabel_nt=%_bulabel% if "%_bulabel_nt%" == "" set _bulabel_nt=%_busystem% for %%A in (%_bu_fixed_paths%) do set _bulabel_nt=!_bulabel_nt! %%~A net start | find /I "MS Software Shadow Copy Provider" >nul: set _swprv=%errorlevel% net start | find /I "Volume Shadow Copy" >nul set _vss=%errorlevel% if "%_swprv%" == "1" net start SwPrv if "%_vss%" == "1" net start vss echo ntbackup backup %_bu_fixed_paths% /f %_bu_fullpath_ext% /j "%_bulabel_nt%" /n "%_bulabel_nt%" /v:no /m %_butype% echo ntbackup backup %_bu_fixed_paths% /f %_bu_fullpath_ext% /j "%_bulabel_nt%" /n "%_bulabel_nt%" /v:no /m %_butype% >%_bu_fullpath%.txt start /b /wait /low ntbackup backup %_bu_fixed_paths% /f %_bu_fullpath_ext% /j "%_bulabel_nt%" /n "%_bulabel_nt%" /v:no /m %_butype% if "%_swprv%" == "1" net stop SwPrv if "%_vss%" == "1" net stop vss set _swprv= set _vss= if not exist %_bu_fullpath_ext% ( echo Error: NTBackup failed to create %_bu_fullpath_ext% goto :eof ) attrib -a %_bu_fullpath_ext% if "%_bucompress%" == "" goto done if "%_bucompress%" == "none" goto done goto ntbackup_%_bucompress% :ntbackup_ :ntbackup_none goto done :ntbackup_rar :: using: :: -df Delete files after archiving :: -ds Do not sort files while adding to a solid archive. :: -idp Disable percentage display :: -ri

[:] Set priority and sleep time. :: -tl Set archive time to newest file. :: -y Assume Yes on all queries. set _rar=-df -ds -idp -ri1:1 -tl -y if not "%_bucompressionlevel%" == "" set _rar=%_rar% -m%_bucompressionlevel% if not "%_bumaxsize%" == "" set _rar=%_rar% -v%_bumaxsize%M if not "%_bupassword%" == "" set _rar=%_rar% -hp%_bupassword% call :unquote %_bu_fullpath_ext% rar a %_rar% "%_rv%.rar" %_bu_fullpath_ext% if not exist "%_rv%.rar" ( echo Error: Rar failed to create "%_rv%.rar" goto :eof ) attrib -a "%_rv%*" goto done :ntbackup_zip echo TODO goto done ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :method_rar ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: not using: :: -ac Clear Archive attribute after compression or extraction :: -ao Add files with Archive attribute set :: -hp[p] Encrypt both file data and headers. :: -m Use best compression method (0=store, 1=fastest, 3=normal, 5=best) :: -v[k|b|f|m|M] Create volumes with size=*1000 [*1024 | *1]. :: -x Exclude specified file , wildcards may be used :: -s Create solid archive. Solid is a special archive type. :: -t Test files after archiving. :: using: :: -ds Do not sort files while adding to a solid archive. :: -ep3 Expand paths to full including the drive letter :: -idp Disable percentage display :: -os Save NTFS streams. :: -ow Use this switch when archiving to save file security :: information and when extracting to restore it. :: -r Recurse subdirectories. :: -ri

[:] Set priority and sleep time. :: -tl Set archive time to newest file. :: -y Assume Yes on all queries. set _rar=-ds -ep3 -idp -os -ow -r -ri1:1 -tl -y for %%i in (%_buexcludes%) do ( set _rar=!_rar! -x"%%~i" ) call :unquote %_bu_path% set _rar=%_rar% -x"%_rv%*" if not "%_bucompressionlevel%" == "" set _rar=%_rar% -m%_bucompressionlevel% if not "%_bumaxsize%" == "" set _rar=%_rar% -v%_bumaxsize%M if not "%_bupassword%" == "" set _rar=%_rar% -hp%_bupassword% set _rar=%_rar% %_buoptions% goto %_bumethod%_%_butyp% :rar_full set _rar=%_rar% -ac goto rar_doit :rar_diff set _rar=%_rar% -ao goto rar_doit :rar_incr set _rar=%_rar% -ac -ao goto rar_doit :rar_copy goto rar_doit :rar_doit for %%i in (%_bupaths%) do call :rar_1param %%i goto done ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :rar_1param ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: : -o+ Overwrite existing files. :: -ow Use this switch when archiving to save file security :: information and when extracting to restore it. :: -r Recurse subdirectories. if /i "%1" == "systemstate" goto rar_systemstate call :map_single_letter_to_drive %1 call :unquote %_rv% set _bu_path1="%_rv%" :: get drive letter call :get_drive_letter %_rv% set _bu_drive=%_rv% set _bu__drive=_%_bu_drive% call :unquote %_bu_fullpath% set _bu_fullpath_d="%_rv%%_bu__drive%" set _bu_fullpath_d_ext="%_rv%%_bu__drive%.%_bu_ext%" call :unquote %_bu_fullpath_d% set _bu_fullpath_d_cmd="%_rv%.cmd" call :unquote %_bu_file% set _bu_file_d_ext=%_rv%%_bu__drive%.%_bu_ext% set _bu_file_d_ext_cmd="%_bu_file_d_ext%.cmd" set _bu_file_d_ext="%_bu_file_d_ext%" echo>%_bu_fullpath_d_cmd% :: %_bu_file_d_ext_cmd% echo>>%_bu_fullpath_d_cmd% :: Commands to restore files in echo>>%_bu_fullpath_d_cmd% :: %_bu_fullpath_d_ext%: echo>>%_bu_fullpath_d_cmd% cd /d %_bu_drive%:\ echo>>%_bu_fullpath_d_cmd% rar x -o+ -ow -r %_bu_file_d_ext% *.* ::title rar a %_rar% %_bu_fullpath_d_ext% %_bu_path1% echo rar a %_rar% %_bu_fullpath_d_ext% %_bu_path1% rar a %_rar% %_bu_fullpath_d_ext% %_bu_path1% if not "%_bupassword%" == "" goto no_comment call :unquote %_bulabel% if "%_rv%" == "" goto no_comment echo %_rv% | rar c %_bu_fullpath_d_ext% :no_comment ::title call :unquote %_bu_fullpath_d_ext% attrib -a "%_rv%*" goto :eof :rar_systemstate call :unquote %_bu_file% call busystem.cmd %_bu_path% "%_rv%_systemstate.rar" goto :eof ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :method_zip ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: TODO flush out call :unquote %_bu_path% set _zip= -x%_rv%* if not "%_bupassword%" == "" set _zip=%_zip% -?%_bupassword% goto %_bumethod%_%_butyp% :zip_full echo TODO goto zip_doit :zip_diff echo TODO goto zip_doit :zip_incr echo TODO goto zip_doit :zip_copy echo TODO goto zip_doit :zip_doit echo TODO goto done ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :done ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: any cleanup needed? :: http://www.ss64.com/nt/shutdown.html if not "%_bushutdown%" == "" shutdown -t 0 -s -c "Shutdown after backup" -d p:0:0 goto :eof ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :quote ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: set _rv="%~1" goto :eof ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :unquote ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: set _rv=%~1 goto :eof ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :get_date ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: set _butemp= for /f "tokens=2" %%a in ("%date%") do for /f "delims=/ tokens=3,1,2" %%b in ("%%a") do set _butemp=%%d-%%b-%%c set _rv=%_butemp:~2% set _butemp= goto :eof ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :get_drive_letter ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: call :unquote %~d1 if not "%_rv%" == "" set _rv=%_rv:~0,1% :: lower case is prettier if /i "%_rv%" EQU "a" set _rv=a if /i "%_rv%" EQU "b" set _rv=b if /i "%_rv%" EQU "c" set _rv=c if /i "%_rv%" EQU "d" set _rv=d if /i "%_rv%" EQU "e" set _rv=e if /i "%_rv%" EQU "f" set _rv=f if /i "%_rv%" EQU "g" set _rv=g if /i "%_rv%" EQU "h" set _rv=h if /i "%_rv%" EQU "i" set _rv=i if /i "%_rv%" EQU "j" set _rv=j if /i "%_rv%" EQU "k" set _rv=k if /i "%_rv%" EQU "l" set _rv=l if /i "%_rv%" EQU "m" set _rv=m if /i "%_rv%" EQU "n" set _rv=n if /i "%_rv%" EQU "o" set _rv=o if /i "%_rv%" EQU "p" set _rv=p if /i "%_rv%" EQU "q" set _rv=q if /i "%_rv%" EQU "r" set _rv=r if /i "%_rv%" EQU "s" set _rv=s if /i "%_rv%" EQU "t" set _rv=t if /i "%_rv%" EQU "u" set _rv=u if /i "%_rv%" EQU "v" set _rv=v if /i "%_rv%" EQU "w" set _rv=w if /i "%_rv%" EQU "x" set _rv=x if /i "%_rv%" EQU "y" set _rv=y if /i "%_rv%" EQU "z" set _rv=z goto :eof ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :get_time ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: for /f "delims=:. tokens=1,2,3" %%f in ("%time%") do set _rv=%%f-%%g-%%h :: fix if time is " 0:12:34" if "%_rv:~0,1%" == " " set _rv=0%_rv:~1,7% goto :eof ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :map_single_letter_to_drive ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: set _rv=%~1 if /i "%_rv%" EQU "a" set _rv=a:\ if /i "%_rv%" EQU "b" set _rv=b:\ if /i "%_rv%" EQU "c" set _rv=c:\ if /i "%_rv%" EQU "d" set _rv=d:\ if /i "%_rv%" EQU "e" set _rv=e:\ if /i "%_rv%" EQU "f" set _rv=f:\ if /i "%_rv%" EQU "g" set _rv=g:\ if /i "%_rv%" EQU "h" set _rv=h:\ if /i "%_rv%" EQU "i" set _rv=i:\ if /i "%_rv%" EQU "j" set _rv=j:\ if /i "%_rv%" EQU "k" set _rv=k:\ if /i "%_rv%" EQU "l" set _rv=l:\ if /i "%_rv%" EQU "m" set _rv=m:\ if /i "%_rv%" EQU "n" set _rv=n:\ if /i "%_rv%" EQU "o" set _rv=o:\ if /i "%_rv%" EQU "p" set _rv=p:\ if /i "%_rv%" EQU "q" set _rv=q:\ if /i "%_rv%" EQU "r" set _rv=r:\ if /i "%_rv%" EQU "s" set _rv=s:\ if /i "%_rv%" EQU "t" set _rv=t:\ if /i "%_rv%" EQU "u" set _rv=u:\ if /i "%_rv%" EQU "v" set _rv=v:\ if /i "%_rv%" EQU "w" set _rv=w:\ if /i "%_rv%" EQU "x" set _rv=x:\ if /i "%_rv%" EQU "y" set _rv=y:\ if /i "%_rv%" EQU "z" set _rv=z:\ goto :eof ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :syntax ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: echo Syntax: echo. echo bu.cmd [options] ^ ^ echo. echo ^ is one or more filespecs to backup. echo If ^ is a single letter (c, d, etc.), then assume c:\, d:\, etc. echo NTBackup also accepts 'systemstate'. echo. echo ^ is the directory to store the backup file to. echo. echo Options: echo. echo -t ^| --type type Backup type echo full: Full backup (default) echo diff: Differential backup echo incr: Incremental backup echo copy: Full copy backup echo. echo -f ^| --filename filename Use filename.[rar^|bkf^|zip] as backup file name echo. echo -u ^| --unique Use unique backup file name (1.rar, 2.rar, etc) echo. echo -l ^| --label "label" Assign "label" as a comment for this backup echo. (incompatible with --password) echo. echo -d ^| --date Save backup in a directory named yy-mm-dd echo. echo -i ^| --time Save backup in a directory name hh_mm_ss echo. echo -y ^| --sysdir Save backup in a directory of the system's name echo. echo -s ^| --system systemname Use systemname instead of %%COMPUTERNAME%% echo. echo -b ^| --method Set backup method echo rar: Use WinRar (default) echo ntbackup: Use NTBackup echo zip: Use WinZip (unimplemented) echo. echo -c ^| --compress mode Compression method (ntbackup method only) echo rar: Use WinRar on NTBackup .bkf file echo zip: Use WinZip on NTBackup .bkf file (unimplemented) echo none: Do not compress (default) echo. echo -x ^| --exclude filespec Filename or path to exclude (rar only) echo. echo -p ^| --password password Encrypt backup with password (rar only) echo. echo -v ^| --maxsize megabytes Maximum backup file size (rar only) echo (limit: 1 source per drive) echo. echo -m ^| --compressionlevel n Set commpression level (1-5) (default=3) (rar only) echo. echo -z ^| --shutdown Shutdown system after backup is completed echo. echo -o ^| --option option Pass option to backup program (ntbackup, rar, etc.) pause echo. echo Examples (on a system named durga) echo. echo bu c z:\ echo Backup c:\ to z:\durga_full_03-03-08_12-34-56_c.rar echo. echo bu -t diff -f root c d z:\ex echo Backup c:\ to z:\ex\root_c.rar and d:\ to z:\ex\root_d.rar echo. echo bu -t diff -f bin c:\bin d:\bin z:\backups echo Backup c:\bin to z:\backups\bin_c.rar and d:\bin to z:\backups\bin_d.rar echo. echo bu -d -f root c d z:\ echo Backup c:\ to z:\03-03-08\root_c.rar and d:\ to z:\03-03-08\root_d.rar echo. echo bu -d -i -f root c z:\ echo Backup c:\ to z:\03-03-08\12_34_56\root_c.rar echo. echo bu -d -i -y -f root c z:\ echo Backup c:\ to z:\03-03-08\12_34_56\DURGA\root_c.rar echo. echo bu -y c z:\ echo Backup c:\ to z:\DURGA\durga_full_03-03-08_12-34-56_c.rar echo. echo bu -b ntbackup c d systemstate z:\ echo Backup c:\, d:\ and systemstate to z:\durga_full_03-03-08_12-34-56.bkf echo. echo bu -b ntbackup -c rar c z:\ echo Backup c:\ and compress to z:\durga_full_03-03-08_12-34-56.bkf.rar