本帖最后由 qixiaobin0715 于 2024-1-16 14:42 编辑
你的需求有点奇葩:- @echo off
- setlocal enabledelayedexpansion
- for /f "tokens=1* delims=-" %%i in ('dir /b /ad') do (
- set str=%%j
- set str=!str:~,3!
- if defined str set _!str!=%%i-%%j
- )
- for /f "tokens=1* delims=-" %%i in ('dir /b /a-d *.doc') do (
- set str=%%j
- set str=!str:~,3!
- if not "%%j"=="" (
- for %%k in (!str!) do (
- if defined _%%k move "%%i-%%j" "!_%%k!\"
- )
- )
- )
- pause
复制代码
|