count - Batch file: store lines of command's output without writing to a file? -
Windows XP
My batch file executes a command that has several lines of output to write on disk How can I count (and store in a variable) without lines of output?
Here is the sample script which will be counted in the output of the dir
command .
@echo off setlocal enabledelayedexpension set for LC = 0 / F "usebackq delims = _" %% i in (`dir`) (copy% i set / an LC =! LC! + 1) Reverse% lc% endlocal
You can replace Dir
with your command and you can use quotation marks and specify the parameters can do. You have to avoid some other characters - though ^
, |
& gt;
and & amp; ;
.
If you do not want to count the lines, but you need to parse each line, then you may have to replace the token delimiter with _
(as I used For example) to do something else that might not be in line split in many tokens.
Comments
Post a Comment