本帖最后由 newswan 于 2021-6-7 16:56 编辑
- @echo off
- setlocal enableDelayedExpansion
-
- set sour=C:\NEW\DATA\A
- set dest=C:\NEW\TEST
-
- pushd %sour%
- for /f "usebackq delims=" %%a in (` dir /b /ad `) do (
- call :f %%a
- )
- popd
- goto :END
-
- :f
- pushd %1
- for /l %%a in (9,-1,0) do (
- for /f "usebackq delims=" %%a in (` dir /b /ad B??????????????%%a* 2^>nul`) do (
- echo "%%~fa"
- goto :break
- )
- )
- :break
- popd
- goto :eof
-
- :END
复制代码 屏幕输出,文件正确的话,第18行修改为复制代码 |