@echo off
set "xml_file=test.xml"
set /p search_for=Enter name:
for /f "skip=2 tokens=3,9 delims=;= " %%a in ('find """%search_for%""" "%xml_file%"') do (
set "name=%%~a"
set "pass=%%b"
)
echo name : %name%
echo pass : %pass%
If all connectionStrings are on split lines, and each row is on the same line. Change the locationxml_file
You can also try xpath.bat (the best option for me) is a small script that allows you to get xml values from an xpath expression without using external binaries:
call xpath.bat connection.xml "//add[@name = 'name1']/@connectionString"
source
share