本帖最后由 rockjean 于 2019-3-27 19:48 编辑
如下代码,不知哪位大神可以指点一二,使之更精简,更合理,更有效率~- @echo off
- setlocal enabledelayedexpansion
-
- ::生成时间戳
- for /f "tokens=1,2,3 delims=/" %%1 in ('echo %date:~0,10%') do set filename=%%1 %%2 %%3
-
- ::开始合并
- for /f "tokens=1,2 delims= " %%a in (01.txt) do echo %%a 00000%%b 09/01/2019 CHILE>>Chile数据包!filename!.txt
- echo 01 end>>Chile数据包!filename!.txt
- for /f "tokens=1,2 delims= " %%a in (02.txt) do echo %%a 00000%%b 09/01/2019 CHILE>>Chile数据包!filename!.txt
- echo 02 end>>Chile数据包!filename!.txt
- for /f "tokens=1,2 delims= " %%a in (03.txt) do echo %%a 00000%%b 09/01/2019 CHILE>>Chile数据包!filename!.txt
- echo 03 end>>Chile数据包!filename!.txt
- for /f "tokens=1,2 delims= " %%a in (04.txt) do echo %%a 00000%%b 09/01/2019 CHILE>>Chile数据包!filename!.txt
- echo 04 end>>Chile数据包!filename!.txt
- for /f "tokens=1,2 delims= " %%a in (05.txt) do echo %%a 00000%%b 09/01/2019 CHILE>>Chile数据包!filename!.txt
- echo 05 end>>Chile数据包!filename!.txt
- for /f "tokens=1,2 delims= " %%a in (06.txt) do echo %%a 00000%%b 15/01/2019 CHILE>>Chile数据包!filename!.txt
- echo 06 end>>Chile数据包!filename!.txt
- for /f "tokens=1,2 delims= " %%a in (07.txt) do echo %%a 00000%%b 15/01/2019 CHILE>>Chile数据包!filename!.txt
- echo 07 end>>Chile数据包!filename!.txt
- for /f "tokens=1,2 delims= " %%a in (08.txt) do echo %%a 00000%%b 09/01/2019 CHILE>>Chile数据包!filename!.txt
- echo 08 end>>Chile数据包!filename!.txt
- for /f "tokens=1,2 delims= " %%a in (09.txt) do echo %%a 00000%%b 09/01/2019 CHILE>>Chile数据包!filename!.txt
- echo 09 end>>Chile数据包!filename!.txt
- for /f "tokens=1,2 delims= " %%a in (10.txt) do echo %%a 00000%%b 09/01/2019 CHILE>>Chile数据包!filename!.txt
- echo 10 end>>Chile数据包!filename!.txt
- for /f "tokens=1,2 delims= " %%a in (11.txt) do echo %%a 00000%%b 15/01/2019 CHILE>>Chile数据包!filename!.txt
- echo 11 end>>Chile数据包!filename!.txt
- for /f "tokens=1,2 delims= " %%a in (12.txt) do echo %%a 00000%%b 15/01/2019 CHILE>>Chile数据包!filename!.txt
- echo 12 end>>Chile数据包!filename!.txt
- for /f "tokens=1,2 delims= " %%a in (13.txt) do echo %%a 00000%%b 15/01/2019 CHILE>>Chile数据包!filename!.txt
- echo 13 end>>Chile数据包!filename!.txt
- for /f "tokens=1,2 delims= " %%a in (14.txt) do echo %%a 00000%%b 09/01/2019 CHILE>>Chile数据包!filename!.txt
- echo 14 end>>Chile数据包!filename!.txt
- for /f "tokens=1,2 delims= " %%a in (15.txt) do echo %%a 00000%%b 09/01/2019 CHILE>>Chile数据包!filename!.txt
- echo 15 end>>Chile数据包!filename!.txt
-
- del *.bat
复制代码
|