我是这样写的,肯定不行,但是我觉得方法应该对:
for /f "tokens=1-4 delims=:-" %%i in ("%date:~0,11%") do set DT=%%i%%j%%k%%l
set DT=%DT: =%
backup database bfgl_001_2009_db to disk='e:\bfback\bfgl_001_2009_db_%DT%.dmp'
e:
cd\bfback
rar a bfgl_001_2009_db_%DT%.rar *.dmp
del *.dmp