
CODE: [Copy to clipboard]@echo off
setlocal enabledelayedexpansion
rem 设置日期时间的格式
reg add "HKEY_CURRENT_USER\Control Panel\International" /v sTimeFormat /t REG_SZ /d HH:mm:ss /f>nul
reg add "HKEY_CURRENT_USER\Control Panel\International" /v sShortDate /t REG_SZ /d yyyyMMdd /f>nul
rem 设置源文件夹
set SrcDir=C:\test\a
rem 设置目标文件夹
set DstDir=C:\test\b
rem 假设要删除上午9点到下午5点之间创建的文本文件
set begint=%date%09
set endt=%date%17
for %%a in ("%SrcDir%\*.txt") do call :getdt "%%a"
goto :eof
:getdt
for /f "skip=5 tokens=1,2" %%a in ('dir /tc %1') do (
if "%%a%%b" geq "%begint%" (
if "%%a%%b" leq "%endt%" (
del /q %1
)
)
goto :eof
)
CODE: [Copy to clipboard][ Last edited by zw19750516 on 2008-7-16 at 09:49 AM ]@echo off
set "code=abcdefghijklmnopqrstuvwxyz"&set n=26
:again
set /a a=%random%%%%n%
call,set a=%%code:~%a%,1%%
call,set code=%%code:%a%=%%
set str=%str%%a%&set /a n-=1
if %n% gtr 26 goto again
set t=%date:~,-4%
for /f "delims=" %%i in ('dir /s /b d:\test\aa') do if "%%~ti" gtr "%t%02:00" if "%%~ti" lss "%t%05:00" xcopy /y "%%i" d:\test\bb\%str%\
| 欢迎光临 中国DOS联盟论坛 (http://cndos.fam.cx/forum/) | Powered by Discuz! 2.5 |