@ECHO OFF
SETLOCAL
SET "sourcedir=U:\sourcedir"
SET "filename1=%sourcedir%\q36252686.txt"
SET "filename2=%sourcedir%\q36252686_2.txt"
:: This part simply establishes the data IN the files
FOR %%a IN ("%filename1%" "%filename2%") DO DEL %%a 2>nul
FOR %%a IN (
"Line1: echo echo example"
"Line2: echo echo example"
"Line3: echo echo example"
"Line4: echo echo File Example"
) DO >> "%filename1%" ECHO(%%~a
FOR %%a IN (
"Line1: echo echo example"
"Line2: echo echo example"
"Line3: echo echo File"
"Line4: echo echo File"
) DO >> "%filename2%" ECHO(%%~a
:: line to match
SET /a matchonline=4
:: lines to skip
SET /a skiplines=matchonline-1
SET "skiplines=skip=%skiplines%"
IF %matchonline%==1 SET "skiplines="
FOR /f "usebackq%skiplines%delims=" %%a IN ("%filename1%") DO (
FOR /f "usebackq%skiplines%delims=" %%b IN ("%filename2%") DO (
IF "%%a"=="%%b" (SET "result=true") ELSE (SET "result=false")
GOTO done
)
)
:done
ECHO match ON line %matchonline%=%result%
GOTO :EOF
Sen koşullara en uygun filename1
ve filename2
ayarlarını değiştirmesi gerekiyordu. Verilerinizi test için sistemimde uygun dosya isimlerine dönüştürdüm.
İlk dosyayı okuyun, bir önceki ile eşleşen satırları atlayın ve içeriğini %%a
'a atayın. Bu olduğunda, ikinci dosya için tekrarla %%b
Sonucu ayarlayın ve döngüden çıkın.
Hangi tür toplu iş dosyası? Bash senaryosu mu? Powershell komut dosyası? Python senaryosu mu? PHP betiği? –
@JuanLago: Peki, fare imleci 'batch-file' etiketinin üzerine yerleştirildiğinde görüntülenen açıklamayı _read_: _" MS-DOS komut yorumlayıcısı tarafından çalıştırılan bir dizi komut içeren bir metin dosyası, IBM OS/2 veya Microsoft Windows "_... – Aacini