将bat文件与处理目录放在一起并执行,请备份文件再测试.
@echo off
for /f "delims=" %%a in ('dir /ad/b') do (
for /f "delims=-" %%b in ("%%a") do (
if not exist "%%b" md "%%b"
move "%%a" "%%b"
)
)
for /f "tokens=1,* delims=-" %%i in ('dir /b /a:d ".\"') do ( set D=%%i
move %%i-%%j %D%)