I have to read contents from a file. In this case, Files.txt. The script is as below:
@echo off
setlocal EnableDelayedExpansion
REM for /F "delims=" %%b in (Files.txt) do @set str1=%%b
REM set str1=bcd
for /F "delims=" %%a in (Files.txt) do (
set str1=%%a
if not x%str1:bcd=%==x%str1% (
echo OK
) else (
echo Not OK
)
)
endlocal
When I assign value of str1 manually, it executes fine but while taking from file which contains multiple values like aer,bcd,123 etc. It fails.
Am I doing any mistake in this script?
if not "!str1:bcd=!"=="!str1!". Read ss64.com/nt/delayedexpansion.html