@ECHO OFF :: Check Windows version IF NOT "%OS%"=="Windows_NT" GOTO Syntax SETLOCAL :: Check command line IF "%~1"=="" GOTO Syntax IF NOT "%~4"=="" GOTO Syntax IF NOT "%~3"=="" IF /I NOT "%~3"=="/T" GOTO Syntax ECHO "%~1" | FIND "/" >NUL || GOTO Syntax ECHO "%~2" | FIND "/" >NUL && GOTO Syntax IF /I "%~3"=="/T" (SET Format=-T) ELSE (SET Format=-D) IF NOT EXIST "%~f2" GOTO Syntax :: Check if XML Starlet is available XML.EXE --version >NUL 2>&1 || GOTO Syntax :: Use XML Starlet to return handle the query XML.EXE sel -R %Format% -t -c "%~1" "%~2" ENDLOCAL GOTO:EOF :Syntax ECHO. ECHO ReadXML.bat, Version 1.10 ECHO Read the specified value from the specified XML file ECHO. ECHO Usage: %~n0 "xpath_expression" "xml_file" [ /T ] ECHO. ECHO Where: "xpath_expression" is the XPATH expression to get the requested value ECHO "xml_file" is the XML file to search ECHO /T output as text (default: XML) ECHO. ECHO Note: Requires XML Starlet, available at http://xmlstar.sourceforge.net/ ECHO. ECHO Written by Rob van der Woude ECHO http://www.robvanderwoude.com IF "%OS%"=="Windows_NT" ENDLOCAL & COLOR 00