本帖最后由 qixiaobin0715 于 2023-5-24 12:19 编辑
批处理文件保存为ANSI编码,未测试:- @echo off
- setlocal enabledelayedexpansion
- for %%a in (春 夏 秋 冬) do (
- set /a n+=1
- set _!n!=%%a
- )
- for /f "delims=" %%i in ('dir /b /ad') do (
- set Folder=%%i
- set Folder=!Folder:+= !
- for %%j in (!Folder!) do (
- set str=%%j
- set str=!str:~,2! !str:~-1!
- for /f "tokens=1*" %%k in ("!str!") do (
- if not exist "%%k年\!_%%l!\%%i" md "%%k年\!_%%l!\%%i"
- copy "%%i\*.*" "%%k年\!_%%l!\%%i\"
- )
- )
- )
- pause
复制代码
|