title= 压缩备份Delphi工程 write by 高文杰 2010-08-01 23:59:59
@ECHO OFF
:color 后面的数字,第一位代表背景色,第二位的数字代表前景色 color 37
:删除D7中临时文件 del /s *.cfg del /s *.dof del /s *.ddp del /s *.~dpk del /s *.~ddp del /s *.~dpr del /s *.~pas del /s *.~dfm del /s *.dcu del /s *.dsk :删除D2007中临时文件 del /s/f/q __history RD __history
:备份文件 echo 当前盘符:%~d0 echo 当前盘符和路径:%~dp0
set "lj=%~p0" set "lj=%lj:\= %" for %%a in (%lj%) do set wjj=%%a echo 当前文件夹:%wjj%
:如果小时数只有一位数字,造成中间有空格而出错的问题,请使用如下方法补0 set hh=%time:~0,2% if /i %hh% LSS 10 (set hh=0%time:~1,1%)
:设置备份文件名称 set bakFileName=%wjj%_%date:~0,4%%date:~5,2%%date:~8,2%_%hh%%time:~3,2%%time:~6,2%.rar
if exist ..\backup goto creat_dst md ..\backup
:creat_dst set rar="%ProgramFiles%\WinRAR\Rar.exe" set inpath=.set outpath=..\backup
%RAR% a -k -r -s -ibck "%outpath%\%bakFileName%" "%inpath%"
echo 当前时间是:%time:~0,2%点%time:~3,2%分%time:~6,2%秒%time:~9,2%厘秒
echo 已经保存到:%outpath%\%bakFileName% echo http://www.2ccc.com pause |