本帖最后由 qixiaobin0715 于 2021-11-18 15:33 编辑
9楼代码是有问题的,还好第10行for循环后面没有其它代码,所以不受影响,如果后面还有其它代码就会出问题。正常应当是下面这样:- @echo off
- setlocal enabledelayedexpansion
- for /f "delims=" %%a in ('dir /b /a-d *.txt *.rar') do (
- set var1=%%a
- set var2=%%a
- for /l %%i in (0,1,9) do set "var1=!var1:%%i=!"
- set "var1=!var1: =!"
- call :a
- )
- pause
- goto :eof
- :a
- for /f "tokens=1* delims=%var1% " %%j in ("!var2!") do (
- cd.>%%j.txt
- if not "%%k"=="" set "var2=%%k"&goto :a
- )
复制代码
|