本帖最后由 aloha20200628 于 2024-12-26 20:56 编辑
回复 1# xukan
以下代码存为 test.bat 运行,与源文件 *.jpg 同目录...
| @echo off &setlocal enabledelayedexpansion | | for /f "delims=" %%F in ('dir /b/a-d *_*p*.jpg') do ( | | set "dd=%%~nF" &set "d=!dd!" &set "n=" &(call :cutEd) | | for %%k in (!k!) do (set "d=!dd:~,%%k!") | | if not exist "!d!\" md "!d!" | | move /y "%%F" "!d!\") | | pause&exit/b | | :cutEd | | if "!d!"=="" (exit/b) else set "c=!d:~-1!" | | if "!c!"=="_" (exit/b) else if /i "!c!"=="p" set "k=!n!" | | set "d=!d:~,-1!" &set/a "n-=1" &goto :cutEdCOPY |
|