<?xml version="1.0" encoding="UTF-8"?>
<bmd:order>
<MessageHeader>
<DateOfMessage>2021-12-20 15:21:26</DateOfMessage>
</MessageHeader>
<OrderReference>313</OrderReference>
<OrderDate>2021-12-20 15:21:26</OrderDate>
<ItemList>
<ListLineItem>
<OrderPosNumber>1</OrderPosNumber>
<DistributorsArticleNo>100-001</DistributorsArticleNo>
<OrderQuantity>1</OrderQuantity>
<price>3,99</price>
</ListLineItem>
</ItemList>
</bmd:order>
<?xml version="1.0" encoding="UTF-8"?>
<post>
<bmd:order>
<MessageHeader>
<DateOfMessage>2021-12-20 15:21:26</DateOfMessage>
</MessageHeader>
<OrderReference>313</OrderReference>
<OrderDate>2021-12-20 15:21:26</OrderDate>
<ItemList>
<ListLineItem>
<OrderPosNumber>1</OrderPosNumber>
<DistributorsArticleNo>100-001</DistributorsArticleNo>
<OrderQuantity>1</OrderQuantity>
<price>3,99</price>
</ListLineItem>
</ItemList>
</bmd:order>
<bmd:order>
<MessageHeader>
<DateOfMessage>2021-12-30 10:14:41</DateOfMessage>
</MessageHeader>
<OrderReference>323</OrderReference>
<OrderDate>2021-12-30 10:14:41</OrderDate>
<ItemList>
<ListLineItem>
<OrderPosNumber>1</OrderPosNumber>
<DistributorsArticleNo>100-007</DistributorsArticleNo>
<OrderQuantity>2</OrderQuantity>
<price>6,00</price>
</ListLineItem>
<ListLineItem>
<OrderPosNumber>2</OrderPosNumber>
<DistributorsArticleNo>100-005</DistributorsArticleNo>
<OrderQuantity>3</OrderQuantity>
<price>1,99</price>
</ListLineItem>
</ItemList>
</bmd:order>
</post>
@echo off
setlocal enableextensions enabledelayedexpansion
:0
if "%~1" == "" (
set /p in="Input file: "
call :0 !in!
exit /b
)
if not exist "%~1" (
echo "%~f1" not found.
endlocal
exit /b 1
)
set /a i = 0
for /f "usebackq skip=1 delims=" %%L in ("%~1") do (
if "%%L" == "<bmd:order>" (
set /a i += 1
(echo ^<?xml version="1.0" encoding="UTF-8"?^>)>!i!.xml
)
(echo(%%L)>>!i!.xml
)
endlocal