Searching Double quote using FINDSTR inside FOR

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
CodedZyntaX
Posts: 15
Joined: 07 Dec 2011 14:34

Searching Double quote using FINDSTR inside FOR

#1 Post by CodedZyntaX » 07 Dec 2011 14:43

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.

!k
Expert
Posts: 378
Joined: 17 Oct 2009 08:30
Location: Russia

Re: Searching Double quote using FINDSTR inside FOR

#2 Post by !k » 07 Dec 2011 14:54

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

CodedZyntaX
Posts: 15
Joined: 07 Dec 2011 14:34

Re: Searching Double quote using FINDSTR inside FOR

#3 Post by CodedZyntaX » 07 Dec 2011 15:05

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!

OJBakker
Expert
Posts: 90
Joined: 12 Aug 2011 13:57

Re: Searching Double quote using FINDSTR inside FOR

#4 Post by OJBakker » 07 Dec 2011 15:14

or with less carets but more ""

Code: Select all

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

CodedZyntaX
Posts: 15
Joined: 07 Dec 2011 14:34

Re: Searching Double quote using FINDSTR inside FOR

#5 Post by CodedZyntaX » 07 Dec 2011 15:33

Thanks guys! I truly appreciate your help.

Post Reply