dbenham wrote:@Squashman - No, penpen is intentionally issuing the SET/P command after the FOR has completed. The code is simply piping 9 normal lines followed by 1 non terminated line consisting of a single character to FINDSTR. It is exactly what Sponge Belly did with sample.txt, except the content is generated dynamically instead of using a static file.
I don't see the point of using the FOR /L. It has no bearing on what is causing the issue. I don't see the point of trying to pipe the ECHO's from the FOR loop to the findstr command. Take the brackets out and it still outputs the same.
Code: Select all
C:\A>(for /l %i in (0,1,9) do @echo:Line_%i.)&set/p"=x "<nul|findstr "^"
Line_0.
Line_1.
Line_2.
Line_3.
Line_4.
Line_5.
Line_6.
Line_7.
Line_8.
Line_9.
x
C:\A>((for /l %i in (0,1,9) do @echo:Line_%i.)&set/p"=x "<nul)|findstr "^"
Line_0.
Line_1.
Line_2.
Line_3.
Line_4.
Line_5.
Line_6.
Line_7.
Line_8.
Line_9.
x