回复 72# forfiles - set SrcDir=D:\temp1
- set DaysAgo=1
- >"%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"
- )
-
- pause
-
- >"%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%
-
- pause
-
- dir %SrcDir%\*.* /tw /od /tw
-
- pause
-
- for /f "skip=3 tokens=1,3,*" %%a in ('dir %SrcDir%\*.* /tw /od') do (echo %%a %%c)
-
- pause
-
- if "1" LEQ "2" echo del /f /q 123
- if "3" LEQ "2" echo del /f /q 456
-
- pause
-
- for /f "skip=3 tokens=1,3,*" %%a in ('dir %SrcDir%\*.* /tw /od') do (
- if "1" LEQ "2" (
- echo %%a %%c
- )
- )
-
- pause
-
-
- >"%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"
-
- pause
复制代码
|