Welcome to TSG!
When using variables inside a For loop, you need to use Delayed Expansion.
Try this:
Code:
@Echo Off
Setlocal EnableDelayedExpansion
For /F "Tokens=*" %%a In ('Dir /A-D /B SourceXML\*.xml') Do (
altovaxml -validate "SourceXML\%%a">tmpFile
Set /P validateOutput=<tmpFile
Del tmpFile
@Echo !validateOutput!
)
Type
Set /? in a Command Prompt for info on Delayed Variable Expansion
EDIT: Would be best to put quotes around the file name, just in case any names have spaces in them, as Squashman just reminded me. And can't hurt to exclude directory names. And specify the Tokens option so names with spaces don't get chopped. Thanks Squashman
Jerry