发现一个很实用的文件整理批处理,但测试下来未实现,请大家帮忙看看到底是哪儿出问题了!
原始代码如下:
发个自用的备份批处理,自动按照文件名、目录名和日期分类保存- @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
复制代码 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
把这个保存成*.REG导入就可以增加到鼠标右键菜单了- Windows Registry Editor Version 5.00
-
- [HKEY_CLASSES_ROOT\*\shell\RAR备份\command]
- @="\"%USERPROFILE%\\SendTo\\RAR备份.bat\" \"%1\""
-
- [HKEY_CLASSES_ROOT\Directory\shell\RAR备份\command]
- @="\"%USERPROFILE%\\SendTo\\RAR备份.bat\" \"%1\""
复制代码
|