Parse XML file for attribute from batch file

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

I am parsing a XML file like below:




   
      
                 


        
3条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-13 03:23

    It works, if you use the right tokens and delimiters:

    @echo off&setlocal
    for /F tokens^=2^,3^,5delims^=^<^"^= %%a in (connection.config) do (
       if "%%a" equ "connection name" echo(%%b %%c
    )
    

    Output is:

    name1 connection1
    name2 connection2
    

提交回复
热议问题