Parse XML file for attribute from batch file

后端 未结 3 944
傲寒
傲寒 2021-01-13 03:05

I am parsing a XML file like below:




   
      
                 


        
3条回答
  •  礼貌的吻别
    2021-01-13 03:16

    Here's the xpath.bat -small script that will allow you to get a xml values by xpath expression without using external binaries:

    call xpath.bat "connection.config" "//connection/@name"
    call xpath.bat "connection.config" "//connection/@value"
    

    to assign this to a variable:

    for /f "tokens=* delims=" %%# in ('xpath.bat "connection.config" "//connection/@value"') do set "connection_value=%%#"
    echo %connection_value%
    

提交回复
热议问题