要想成功运行以下代码,请楼主确保a.txt和z*.txt所有列间的分隔符只有一个,或为空格,或为制表符,同时空着的列为空格所替代:- @echo off&setlocal enabledelayedexpansion
- for /f "delims=" %%a in (a.txt) do set /a n+=1&set "_!n!=%%a"
- for /l %%a in (1,1,%n%) do (
- (for /f "delims=" %%b in (z%%a.txt) do (
- set "str=%%b"
- for /l %%b in (0,2,40) do (
- set "a=!str:~%%b,1!"
- if "!a!" lss "0" set /a a=0
- set /a "a=(a+!_%%a:~%%b,1!) %% 10"
- set "var=!var! !a!"
- )
- echo,!var:~1!&set "var="
- ))>s%%a.txt
- )
复制代码
|