
【已解決】BAT多個代碼如何合并成一個@echo offfor /f skip=1 delims= %%i in ('dir /b /a-d /o-n /s d:分解數據1001lishi*.txt') do (copy %%i d:分解數據2001.txtgoto :eof)@echo offfor /f skip=1 delims= %%i in ('dir /b /a-d /o-n /s d:分解數據1002lishi*.txt') do (copy %%i d:分解數據2002.txtgoto :eof)......@echo offfor /f skip=1 delims= %%i in ('dir /b /a-d /o-n /s d:分解數據11330lishi*.txt') do (copy %%i d:分解數據21330.txtgoto :eof)上述代碼是將一文件夾內倒數第二行的txt文本數據導出現在欲將上述若干代碼合而為一,自己試寫了如下代碼,但是只能導出0001.txt,錯在哪?
- @echo off&setlocal enabledelayedexpansion
- for /l %%x in (10001,1,11330) do (
- set y=%%x
- pushd d:分解數據1!y:~1!lishi
- for /f skip=1 delims= %%i in ('dir /b /a-d /o-n /s *.txt') do (
- copy %%i d:分解數據2!y:~1!.txt
- goto :eof
- )
- )
nclick="copycode($('code0'));">復制代碼