日期:2014-05-17  浏览次数:20773 次

批处理文件移动
一个关于批处理的问题 一个文件夹test1里面有ch05_xx_20110809 ch05_yy_20110809 ch05_xx_20110709 ch05_yy_20110709 四个文件 想找出时间最晚的两个文件ch05_xx_20110809和 ch05_yy_20110809然后复制到另外一个文件夹test2中并且改名ch06_xx_20110809和 ch06_yy_20110809 有点棘手 望相各位助一下 小弟感激不胜~~

------解决方案--------------------
test.bat

BatchFile code
@echo off
setlocal enabledelayedexpansion
for /f "skip=2 delims=" %%a in ('dir /s /b /od "C:\test1\ch0*"') do (
    set str=%%~na
    copy "%%a" "C:\test2\!str:~0,2!06!str:~4,12!"
)