- 帖子
- 13
- 积分
- 15
- 技术
- 0
- 捐助
- 0
- 注册时间
- 2012-5-11
|
9楼
发表于 2012-5-16 09:04
| 只看该作者
回复 8# gawk
E:\>定时删除.bat
E:\>setlocal EnableDelayedExpansion
E:\>chcp 936
活动的代码页: 936
E:\>set "_tian=1"
E:\>echo wscript.echo dateadd("d",1,date) 1>tmptmp.vbs
E:\>for /F "tokens=1,2,3* delims=-" %i in ('cscript /nologo tmptmp.vbs') do (set
"y=%i" & set "m=%j" & set "d=%k" )
E:\>(set "y=2012" & set "m=05" & set "d=17" )
E:\>set "rq=2012-05-17"
E:\>echo. & echo 注意:即将删除 2012-05-17 以前建立的文件
注意:即将删除 2012-05-17 以前建立的文件
E:\>for /F "delims=" %a in ('dir/b/a-d E:\test_batch\*.*') do (
echo %a 1>>fyr21.txt
set "a=0"
for /F "skip=4 delims=" %b in ('dir/tc "E:\test_batch\%a"') do (
set /a "a+=1"
if !a! EQU 1 (
set "var=%b"
for /F "tokens=1 delims= " %c in ("!var!") do set "str=%c"
echo !str! 1>>fyr22.txt
if !str! LSS !rq! del /q "E:\test_batch\%a"
)
)
)
E:\>(
echo F2010新帐套.dbb 1>>fyr21.txt
set "a=0"
for /F "skip=4 delims=" %b in ('dir/tc "E:\test_batch\F2010新帐套.dbb"') do (
set /a "a+=1"
if !a! EQU 1 (
set "var=%b"
for /F "tokens=1 delims= " %c in ("!var!") do set "str=%c"
echo !str! 1>>fyr22.txt
if !str! LSS !rq! del /q "E:\test_batch\F2010新帐套.dbb"
)
)
)
找不到文件
E:\>(
echo F查询帐套.bak 1>>fyr21.txt
set "a=0"
for /F "skip=4 delims=" %b in ('dir/tc "E:\test_batch\F查询帐套.bak"') do (
set /a "a+=1"
if !a! EQU 1 (
set "var=%b"
for /F "tokens=1 delims= " %c in ("!var!") do set "str=%c"
echo !str! 1>>fyr22.txt
if !str! LSS !rq! del /q "E:\test_batch\F查询帐套.bak"
)
)
)
找不到文件
E:\>(
echo F查询帐套.dbb 1>>fyr21.txt
set "a=0"
for /F "skip=4 delims=" %b in ('dir/tc "E:\test_batch\F查询帐套.dbb"') do (
set /a "a+=1"
if !a! EQU 1 (
set "var=%b"
for /F "tokens=1 delims= " %c in ("!var!") do set "str=%c"
echo !str! 1>>fyr22.txt
if !str! LSS !rq! del /q "E:\test_batch\F查询帐套.dbb"
)
)
)
找不到文件
E:\>del/q tmptmp.vbs
还是不行~ |
|