**names.txt** host1 host2 host3 **chk1.bat** @echo off setlocal EnableDelayedExpansion FOR /F "tokens=* delims=" %%x in (names.txt) DO ( set name=%%x call chk2.bat **chk2.bat** @echo off setlocal EnableDelayedExpansion IF /I name==%FQDN% echo "match found" pause The 1st batch file would call the 2nd batch file which performs the check. Unfortunately Batch files don't allow nesting of loops (or even including IF statements inside a FOR loop)