@echo off
setlocal enabledelayedexpansion
::截取前几位
set num=4
for /f "delims=" %%a in ('dir /a-d/b *.*') do (
if not "%%~nxa"=="%~nx0" (
set tmp=%%~na
set tmp=!tmp:~,%num%!
if not exist "!tmp!\" (
md "!tmp!"
move %%~fsa "!tmp!"
) else (
move %%~fsa "!tmp!"
)
)
)
echo end...
pause