Forgive me if this has been asked before but my searches have come up with nothing similar....
I have a batch file that uses a for loop to go through a comma delimited file that is formatted like this...
Pathname,client
The batch is intended to pass the path to a logparser command which in turn sums a column of data. I am trying to get my results sent to a single file in which the client and results are listed on the same line like this...
client, sum
client, sum
However when I attempt to do so with echos and redirects (>>) the values end up on seperate lines like this...
client,
sum
client,
sum
In my search I noted that using the "SETLOCAL ENABLEDELAYEDEXPANSION" should work but I have not had any luck. SS64 I have tried variations of variables with no luck. The command is ran from a batch file, not command line.
SETLOCAL ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
for /f "tokens=1,2 skip=1 delims=," %%f in (faxreportnames.csv) do (
echo %%g,>>parse_page_counts.txt
logparser -i:csv "select sum(NUMPAGES) from %%f where FAX_STATUS = 'SUCCESSFUL'" -q:on -rtp:-1 -headers:off>>parse_page_counts.txt
)
I have a feeling it is something silly simple but after several hours of trying, I think I am missing it...
Edit for clarity:
- The issue is more where a CRLF is being added when using the echo
statement. My searches said using the "EnableDelayedExpansion" should
resolve the issue... I am aware using echo causes the CRLF to be
appended.
- The values in the .csv file being read are strictly text.
First column is the path and path name of a .csv to be parsed. Second
column is the client name.
- The values returned by %%f and %%g are correct.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…