I'm trying to create a batch file which reads an identical XML files stored in two different locations and compares whether their build version is the same or not using the build tag in the xmls file.The batch code is..
Batch code is..
@echo off
setlocal enableextensions disabledelayedexpansion
set "build="
set "build1="
set "ans=version same"
set "wrong=version not same"
for /f "tokens=3 delims=<>" %%a %%b in (
'find /i "<Build>" ^< "C:\Users\Lucy\Desktop\piller-uniblock\master.xml" "C:\piller-uniblock\master.xml" '
) do set "build=%%a" "build1=%%b"
IF "%build%"=="%build1%" echo %ans%
else echo %wrong%
I'm trying to store the value of build tag of the two xml files in 2 variables, then compare them.If they are same then it prints "same" else "not same" through variables.
The XML file stored at two different locations which I'm trying to read is
master.xml
<?xml version="1.0" encoding="UTF-8"?>
<CDMDataXML xmlns="http://ift.tt/1sXyXV0" xmlns:xsi="http://ift.tt/ra1lAU" xsi:schemaLocation="http://ift.tt/1sXyXV0 CDMLoaderXMLSchema.xsd">
<CDMDataVersion>
<Major>1</Major>
<Minor>0</Minor>
<Build>50</Build>
<Delimiter>.</Delimiter>
</CDMDataVersion>
The error message I'm getting is..
I can't understand where I'm making a mistake in this code.Please Help..
No comments:
Post a Comment