::RAR自动备份批处理, ::执行exe文件会自动选择正确路径安装, ::你要自己拷贝也行
::以后在任何要备份的文件或目录上点右键, ::发送到“RAR备份”即可自动压缩到E:BAKFILES下的分类文件夹
::备份文件包含完整路径,恢复是解压到对应盘符下的根目录即可
@echo off ::把RAR备份.bat文件放到SendTo目录下 ::以后只要把要备份的文件或目录发送到“RAR备份”,就会自动按照文件名、 ::目录名和日期分类并以最高WINRAR的最高压缩方式保存
::设置要保存到哪个盘 set bakdrive=e: ::设置要保存到哪个目录 set bakpath=E:BAKFILES ::设置要WINRAR的路径,这是默认安装路径 set path=%path%;%ProgramFiles%WinRAR;
FOR /F "usebackq eol=; tokens=1* delims=, " %%i IN (`date /t`) DO set bakfile=%%i FOR /F "usebackq eol=; tokens=1* delims=, " %%i IN (`echo %1`) DO set bakdir=%%~nj FOR /F "usebackq eol=; tokens=1* delims=, " %%i IN (`echo bakfile1`) DO set bakfile=%%~nj FOR /F "usebackq eol=; tokens=1* delims=, " %%i IN (`echo %1`) DO set sfile=%%i
%bakdrive% md %bakpath%BAK_%bakdir% md %bakpath%"BAK_%bakdir% cd %bakpath%BAK_%bakdir% cd %bakpath%"BAK_%bakdir% ::目录和文件对长文件名和引号处理不一致,懒得想就两个都写上了:-)
rar a -dh -ag -m5 -r -o+ -isnd -tl -y BAK_ %1
echo echo on
相关链接:https://bbs.21ic.com/upfiles/img/200710/2007102682214610.rar |