|
|
楼主 |
发表于 2015-5-24 17:07:12
|
显示全部楼层
还是不行啊,老师,是不是改成下面这样?试了还是不行的,
@echo off
rem 指定待删除文件的存放路径 系统日期改格式yyyy-mm-dd
set SrcDir=I:\Windows\ESWeb\
set SrcDir1=I:\Windows\KIS_2014\
set SrcDir2=I:\Windows\TOP_2014\
set SrcDir3=I:\Windows\TOP_2015\
rem 指定天数
set DaysAgo=4
>"%temp%\BackupDate.vbs" echo Set WshShell = WScript.CreateObject("WScript.Shell")
>>"%temp%\BackupDate.vbs" echo WScript.Echo WshShell.RegRead ("HKEY_CURRENT_USER\Control Panel\International\sShortDate")
for /f %%a in ('cscript /nologo "%temp%\BackupDate.vbs"') do (
set "RegDateOld=%%a"
)
>"%temp%\UnifyDate.vbs" echo Set WshShell = WScript.CreateObject("WScript.Shell")
>>"%temp%\UnifyDate.vbs" echo WshShell.RegWrite "HKEY_CURRENT_USER\Control Panel\International\sShortDate", "yyyy-M-d", "REG_SZ"
cscript /nologo "%temp%\UnifyDate.vbs"
>"%temp%\DstDate.vbs" echo LastDate=date()-%DaysAgo%
>>"%temp%\DstDate.vbs" echo FmtDate=right(year(LastDate),4) ^& right("0" ^& month(LastDate),2) ^& right("0" ^& day(LastDate),2)
>>"%temp%\DstDate.vbs" echo wscript.echo FmtDate
for /f %%a in ('cscript /nologo "%temp%\DstDate.vbs"') do (
set "DstDate=%%a"
)
set DstDate=%DstDate:~0,4%-%DstDate:~4,2%-%DstDate:~6,2%
set filepath="I:\Windows\ESWeb\" "I:\Windows\KIS_2014\" "I:\Windows\TOP_2014\" "I:\Windows\TOP_2015\"
for %%f in (filepath) do (
for /f "delims=" %%a in ('dir /s/b/a-d %%f') do (
if "%%~ta" leq "%DstDate%" Echo "%%a"
)
)
>"%temp%\RecoverDate.vbs" echo Set WshShell = WScript.CreateObject("WScript.Shell")
>>"%temp%\RecoverDate.vbs" echo WshShell.RegWrite "HKEY_CURRENT_USER\Control Panel\International\sShortDate", "%RegDateOld%", "REG_SZ"
cscript /nologo "%temp%\RecoverDate.vbs" |
|