Page 1 of 1

Searching Double quote using FINDSTR inside FOR

Posted: 07 Dec 2011 14:43
by CodedZyntaX
Hi Guys,


I need help please.

I have a test file named s.txt.

Here's the contents of the s.txt:

$
%
"

When I type in

FINDSTR /n /c:""" s.txt

in the command line the output is 3:".

However when I type in

FOR /f "tokens=1 delims=:" %a in ('FINDSTR /n /c:"""' s.txt') do echo %a

after I pressed the ENTER key it's asking me "More?".

Please help me.

Re: Searching Double quote using FINDSTR inside FOR

Posted: 07 Dec 2011 14:54
by !k
FOR /f "tokens=1 delims=:" %a in ('FINDSTR /n /c:^"^"^" s.txt') do echo %a

Re: Searching Double quote using FINDSTR inside FOR

Posted: 07 Dec 2011 15:05
by CodedZyntaX
Thank you so much !K.

I appreciate your help.

I just registered an hour ago and I didn't expect that I will get an answer within an hour.

Again, Thank you!

Re: Searching Double quote using FINDSTR inside FOR

Posted: 07 Dec 2011 15:14
by OJBakker
or with less carets but more ""

Code: Select all

FOR /f "tokens=1 delims=:" %a in ('"FINDSTR /n /c:"^"" s.txt"') do echo %a

Re: Searching Double quote using FINDSTR inside FOR

Posted: 07 Dec 2011 15:33
by CodedZyntaX
Thanks guys! I truly appreciate your help.