findstr /spin
it search in subdirectories (/s
) omitting non printable files (/p
) ignoring case (/i
) numbering output lines (/n
), and you are not giving any file, so findstr
fails as its arguments are not correct. From here you get errorlevel 1, so, the code inside the if
is not executed
Better use
for /F "usebackq tokens=1 skip=1" %%A in ("%ContentFilePath%") do ( SET "ProfileName=%%A" )
ECHO %ProfileName%| find ";" > nul
IF %ERRORLEVEL%==0 (
FOR /F "tokens=1,2 delims=;" %%A in ("%ProfileName%") do ( SET "ProfileName=%%A" & SET "RRSProfileName=%%B" )
)
Or just (if it is possible, i don't know all your cases), join the two steps into one
for /f "usebackq tokens=1,2 skip=1 delims=;" %%a in ("%ContentFilePath%"
) do ( set "ProfileName=%%a" & set "RRSProfileName=%%b" )
It reads the same required line, if semicolon is present, it is used to split the line and each of the variables retrieve the required content.