@ECHO OFF if '%1 == ' goto no-params set which_xerces=..\..\lib\ goto xerces :xerces if not exist %1 goto no-file set xerces_CLASSPATH=%CLASSPATH%;%which_xerces%xercesImpl.jar set xerces_CLASSPATH=%xerces_CLASSPATH%;%which_xerces%xercesSamples.jar set xerces_CLASSPATH=%xerces_CLASSPATH%;%which_xerces%xmlParserAPIs.jar java -classpath %xerces_CLASSPATH% sax.Counter -v -s -n %1 echo. echo Done. echo. set xerces_CLASSPATH=%CLASSPATH% goto eof :no-params cls echo Oops! You need to run the batch file with an argument. echo Here's how to use it ... echo. echo Usage: "validate " echo. goto eof :no-file cls echo Oops! %1 does not exist echo Most likely reason: mistyped filename echo Exiting ... echo. goto eof :eof