本帖最后由 apang 于 2012-11-19 00:13 编辑
是这个意思吗?- @echo off
- for /f "delims=" %%a in ('dir /a-d /b *.txt') do (
- for /f "tokens=1* delims=$" %%b in ("_%%~na") do (
- if "%%c" neq "" (
- set "str=%%c"
- set "Name=%%a"
- setlocal enabledelayedexpansion
- md "!str:~,5!" 2>nul
- move "!Name!" "!str:~,5!\"
- endlocal
- ) else md "Other" 2>nul&move "%%a" "Other\"
- )
- )
- pause
复制代码
|