@echo off rem 把RAR备份.bat文件放到SendTo目录下 rem 以后只要把要备份的文件或目录发送到“RAR备份”,就会自动按照文件名、 rem 目录名和日期分类并以最高WINRAR的最高压缩方式保存
rem 设置要保存到哪个盘 set bakdrive=e: rem 设置要保存到哪个目录 set bakpath=E:BAKFILES rem 设置要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 |