The output I need is:
Date,Dealer,Account
I'm getting date from the directory listing.
Dealer is within the XML file itself with a tag labeled as <Dealer>1234</Dealer>
Account is part of the filename Accountnumber_VerylongUID.xml which I am further parsing from the command line string.
I can get the output I need in the following format:
Date,
Dealer,
Account
Simply by echoing the For Loop Variables as I get them. However... I'd like to get them on the same lines and for that, I believe I need to have them in a single Echo statement. (although I could be wrong).
My delayed expansion doesn't seem to be working right and I'm sure I'm missing something simple, but any help would be appreciated. Here is what I have:
Code: Select all
@ECHO OFF
SETLOCAL EnableDelayedExpansion
SET DLR=123
SET ACCT=456
(
FOR /F "tokens=1,2,3,4,5 delims= " %%A IN ('DIR /OD ^| FIND "xml"') DO (
FOR /F "tokens=3 delims=><" %%k IN ('TYPE %%E ^| FIND "Dealer"' ) DO (SET DLR"=%%k")
FOR /F "tokens=1 delims=_" %%n IN ("%%E") DO (SET ACCT"=%%n")
ECHO %%A,!DLR!,!ACCT!
)
) > Testing.txt