首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 操作系统 >

bat批处理剔除指定天数日期之前的文件夹(转)

2012-07-16 
bat批处理删除指定天数日期之前的文件夹(转)? set RegDateOld%%a)set RegDateOld%RegDateOld:~-8%reg

bat批处理删除指定天数日期之前的文件夹(转)

? set "RegDateOld=%%a"
)
set RegDateOld=%RegDateOld:~-8%
reg add "HKEY_CURRENT_USER\Control Panel\International" /v sShortDate /t REG_SZ /d yyyy-M-d /f>nul
>"%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%
for /d? %%a in ("%SrcDir%\*.*") do (
? if "%%~ta" leq "%DstDate%" (
??? if exist "%%a"
????? echo rd /s /q "%%a"
??? )
? )
)
reg add "HKEY_CURRENT_USER\Control Panel\International" /v sShortDate /t REG_SZ /d %RegDateOld% /f>nul
pause

热点排行