You are not logged in.

#1 02 Jan 2015 08:18

pratibha
New Member
Registered: 02 Jan 2015
Posts: 1

Batchfile_array.

i am reading a text file line by line with a specific string and then storing each string in array.now i have to compare each array element with a specific string.i have tried with the below code .........
setlocal enabledelayedexpansion enableextensions
for /F "tokens=2,3 delims= " %%a in ('findstr "associationMaxRtx maxIncomingStream maxOutgoingStream initialAdRecWin maxUserdataSize mBuffer nThreshold PathMaxRtx maxInitialRtrAtt minimumRto maximumRto initialRto rtoAlphaIndex tSack" C:\Users\ephajin\logs.txt') do (
     set /A count+=1
     set vartmp1=%%a
     set vartmp2=%%b
     set "array[!count!]="%%a %%b""
)

(FOR /L %%a IN (1,1,%count%) DO SET "result=!result! !array[%%a]!"
if %result% == "associationMaxRtx 8"(
echo no need of modification) > result.txt
but in result file i am receiving following input:
in result file all array element is showing in a line why i dont know but it is actually as below
array[0]=get .
array[1]=associationMaxRtx 8   
array[2]=associationMaxRtx 8
so on.I have to compare each array element with a specific string for example array[1]="associationMaxRtx 8",and then print a message .How to do this please help me

Offline

Board footer

Powered by