Rather than compare them, I'd write a script to recreate the XML files from the output of a tool such as ImageMagick's
I'd start with something like
for %f in (*.*) do ^
identify -format '<IMGRES WIDTH="%w" HEIGHT="%h" />' %f% > %f%.xml
Then fix up the filename extension handling etc etc.
To do a comparison as you ask, I'd use a better scripting language (Perl in my case, but I expect many other people would use the built-in powershell)
You could use the code above but write the output to a fixed filename and then use
if in the for-loop to generate your desired output.
To do what you ask using only built-in tools I'd look at powershell.
Here is an example from powershellcommunity.org which you could use as a starting point.
$image = [System.Drawing.Image]::FromFile($File)
$imageStream = New-Object System.IO.MemoryStream
"Name|SizeInBytes|Width|Height" >> C:\JPGInfo.txt
$path = "C:\Images\"
$imageFiles = Get-ChildItem -Recurse $path -Include *.jpg
foreach ($image in $imageFiles)
$name = $image.Name
$length = $image.Length
$imageStream = _Get-ImageStream -File $image.FullName
$width = $imagestream.Width
$height = $imageStream.Height
"$name|$length|$width|$height" >> C:\JPGInfo.txt