findstr in variable

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
booga73
Posts: 108
Joined: 30 Nov 2011 16:16

Re: findstr in variable

#16 Post by booga73 » 13 Feb 2013 15:29

C:\Temp1>find /c /v "" sample.txt

---------- SAMPLE.TXT: 18

C:\Temp1>

Okay, well, my test text file shows 18 lines, the output shown is 18.

send me a private message please.

very respectfully, booga73

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: findstr in variable

#17 Post by Squashman » 13 Feb 2013 15:33

booga73 wrote:C:\Temp1>find /c /v "" sample.txt

---------- SAMPLE.TXT: 18

C:\Temp1>

Okay, well, my test text file shows 18 lines, the output shown is 18.

send me a private message please.

very respectfully, booga73


I don't do help over PM.
Your output is ---------- SAMPLE.TXT: 18
That is what you are trying to assign to your variable LineNumb in your FOR command.
You are not assigning the number 18 to LineNumb!
Get it now?

booga73
Posts: 108
Joined: 30 Nov 2011 16:16

Re: findstr in variable

#18 Post by booga73 » 13 Feb 2013 16:27

at this time, presently yes .. . .

---------- SAMPLE.TXT: 18 ---> was being assigned to !LineNumb! and not just the interger 18.

v/r Booga73

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: findstr in variable

#19 Post by foxidrive » 14 Feb 2013 04:20

Squashman is right, I posted the method you should use when using FIND. It involves redirection - check my previous post in this thread.

Post Reply