I have set my arrays like this:
SET ORG[0]=Microsoft
SET ORG[1]=Google
SET ORG[2]=Yahoo
SET ORG[3]=Snapchat
SET ORG[4]=Whatsapp
SET ORG[5]=Facebook
Then I do a find in one of the files to get the value stored in the file:
For /F Tokens^=10^ Delims^=^" %%A in ('Find /I "%Client%"^<"C:\Env\Test\test.xml"') Do Echo "%%A" & SET "ORG=%%A"
Where ORG can be any of the above mentioned array values depending on what's stored in the file. For example say for this instance:
ECHO %ORG% gives Google.
I would like to compare my %ORG% value fetched from the file against the set array values and If its equal then I want my batch script to:
GOTO :Action Else
ECHO "Client Name Not Found"
I am not sure how to compare a variable with the values in the array?
<Org Updated="date" Owner="Test" Version="2/1/3/4"Database="Test" Client="Name">. I am able to get 'Name' from the xml so thats not an issue. All i need to know here is how to compare %ORG% variable with the fixed values stored in the array. the solution should cover any additional array value which might be added in the future.if %ORG% == ORG[] GOTO Action ELSE ECHO Client Not found & GOTO Action2please ignore the syntax here i am just trying to explain my requirementset ORG[ | find /i "%%~A" >NUL && (echo Found) || (echo Not Found)or similar?