What do you mean by "get"? ECHO? Write to a file? Load into a variable?
To get echo, try this:
DIR 2012*.XML /B > TEST.TXT
for /F "eol=. tokens=2 delims=2." %i in (test.txt) do @echo %i
The first line creates a text file with bare names of all matching files.
The second line runs on the text file, splitting it into 'tokens' each time it finds a 'delimiter'.
The delimiters are 2 and dot.
If your file is 2012p03b.xml, the tokens would be: 201
The second token (%i) would be p03b.
Hope this points you in the right direction,