本帖最后由 思想之翼 于 2014-10-17 14:21 编辑
@echo off&setlocal enabledelayedexpansion
set filenum=100
for /l %%a in (1,1,%filenum%) do (
for /f "delims=" %%i in (D:\模版\模版1\模版1_001\lishi\%%a.txt) do (
set /a n+=1
for %%a in (!n!) do set "#%%a=!#%%a! %%i"
)
set /a m=n,n=0
)
(for /l %%a in (1,1,!m!) do echo,!#%%a:~1!)>D:\模版\数据(横并)1\001.txt
exit
@echo off&setlocal enabledelayedexpansion
set filenum=100
for /l %%a in (1,1,%filenum%) do (
for /f "delims=" %%i in (D:\模版\模版1\模版1_002\lishi\%%a.txt) do (
set /a n+=1
for %%a in (!n!) do set "#%%a=!#%%a! %%i"
)
set /a m=n,n=0
)
(for /l %%a in (1,1,!m!) do echo,!#%%a:~1!)>D:\模版\数据(横并)1\002.txt
exit
......
@echo off&setlocal enabledelayedexpansion
set filenum=100
for /l %%a in (1,1,%filenum%) do (
for /f "delims=" %%i in (D:\模版\模版1\模版1_100\lishi\%%a.txt) do (
set /a n+=1
for %%a in (!n!) do set "#%%a=!#%%a! %%i"
)
set /a m=n,n=0
)
(for /l %%a in (1,1,!m!) do echo,!#%%a:~1!)>D:\模版\数据(横并)1\100.txt
exit
将上述100个类似的代码,合并如下,代码不运行,为何?- @echo off
- set filenum=100
- for /l %%x in (1001,1,1100) do (
- set y=%%x
- setlocal enabledelayedexpansion
- for /l %%a in (1,1,%filenum%) do (
- for /f "delims=" %%i in (D:\模版\模版1\模版1_!y:~1!\lishi\%%a.txt) do (
- set /a n+=1
- for %%a in (!n!) do set "#%%a=!#%%a! %%i"
- )
- set /a m=n,n=0
- )
- (for /l %%a in (1,1,!m!) do echo,!#%%a:~1!)>D:\模版\数据(横并)1\!y:~1!.txt
- endlocal
- )
- exit
复制代码
|