本人在测试时发现设置的N这个天数不准确,明明设置了删除30天以前的,但是执行却会把当天测试的文件夹都删掉。请高手指点:
@echo off&setlocal enabledelayedexpansion
title %date% %time:~,8%
set d=%date:~0,10%
mshta vbscript:createobject("scripting.filesystemobject").opentextfile("temp.txt",2,true).write(dateadd("d",-30,"%d%"))(window.close)
for /f "tokens=1 delims= " %%i in (temp.txt) do set t1=%%i
for /f "delims= " %%i in ('dir /ad/b F:\abc\????????') do (
set t2=%%i
set t3=!t2:~0,10!
if !t3! lss !t1! rd /s/q "F:\abc\%%i")
del /f temp.txt&
pause
第1个回答 2012-07-10
@echo off
set n=30
pushd f:\abc
for /f "skip=%n%" %%i in ('dir/b/ad/o-d 20??????') do rd %%i /s/q
pause本回答被提问者采纳
set n=30
pushd f:\abc
for /f "skip=%n%" %%i in ('dir/b/ad/o-d 20??????') do rd %%i /s/q
pause本回答被提问者采纳
第2个回答 2012-07-10
不知道。