- @echo off&&setlocal EnableDelayedExpansion
- cd /d d:\aa\
- mkdir tmp
-
- for /f %%i in ('dir /a:-d /b') do (
- set filename=%%i
- set year=!filename:~0,4!
- if "!year!" leq "2013" move %%i tmp/>nul
- )
- cd tmp
- move 20131231.xls ..\>nul
- del /q *
- cd ..
- rmdir tmp
- pause
复制代码 希望这段代码能够帮助你 |