Batch how to set FINDSTR result to a variable and disable findstr print to console?

The first problem is because you just take the first token from FOR. To solve it, you have two solutions, either to echo the complete line where the string is found.

The first problem is because you just take the first token from FOR. To solve it, you have two solutions, either to echo the complete line where the string is found... for /f %%i "tokens=*" in ('FINDSTR /C:"Result Comparison Failure" %tmp_result_file%') do echo %%i or echo the three tokens found for /f %%i in ('FINDSTR /C:"Result Comparison Failure" %tmp_result_file%') do echo %%i %%j %%k the second problem, the xx echoed two times is because you run two times the command. The first xx is the one from the first run, the second one is from the second run.

If you want to prevent the second one, you need to use some additional logic. For example, setting a variable and then checking it. Warning, setting a variable in a loop requires enabling delayed expansion and using the!

Xx! Syntax (see HELP SET for a detailed explanation) setlocal enabledelayedexpansion ... set result= for /f %%i "tokens=*" in ('FINDSTR /C:"Result Comparison Failure" %tmp_result_file%') do ( set result=%%i ) if "! Result!"=="" ( echo!

Result! ) else ( echo xx ).

Like this (in the inner loop's body): IF "%%i" == "" (ECHO xx) ELSE ECHO %%i. – Andriy M Sep 30 at 8:11 yep, you're right, that's a possibility.. I just reused code handling multiple find results. – PA.

Sep 30 at 9:36.

Check out the FOR /F command. For /f %i in ('FINDSTR /C:"Result Comparison failure" %tmp_result_file%') do ...

To see all the options. The delims option seems relevant here. I was trying to point you in the right direction, not to solve your entire problem for you.

– Raymond Chen Sep 30 at 3:52 You probably want for /f "delims=" %%i in (... – Gabe Sep 30 at 4:31.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions