方法一:- @echo off
- :lp
- if defined n (
- set "sk=skip=%n% "
- ) else (
- set /a m=0
- )
- if "%_a%" equ "%_b%" set /a m+=1
- for %%a in (a b) do (
- set "_%%a="
- for /f "%sk%delims=" %%b in (%%a.txt) do if not defined _%%a set "_%%a=%%b"
- )
- set /a n+=1
- if defined _a goto lp
- echo a.txt和b.txt有%m%行相同
- pause>nul
复制代码 方法二:- @echo off&setlocal enabledelayedexpansion
- set /a num=0
- for /f "delims=" %%a in (a.txt) do set /a n+=1&set "_!n!=%%a"
- for /f "delims=" %%a in (b.txt) do set /a m+=1&set ".!m!=%%a"
- for /l %%a in (1,1,%n%) do if "!_%%a!" equ "!.%%a!" set /a num+=1
- echo a.txt和b.txt有%num%行相同
- pause>nul
复制代码
[ 本帖最后由 batman 于 2011-2-28 16:03 编辑 ] |