Read XML file with windows batch

后端 未结 4 602
北荒
北荒 2021-01-23 08:09

I\'m trying to read an xml file and read STRING \"50\" between the build tags from a XML file. I tried it but I\'m not getting any output.

The XML file..



        
4条回答
  •  情话喂你
    2021-01-23 08:33

    Retrieve only the required line (find), and using the adecuated delimiters (<>), tokenize the line to retrieve the required information

         delims:    v     v  v      v
         line  :    50
         tokens:^1   ^2    ^3 ^4
    

    Now, translate this into code

    @echo off
        setlocal enableextensions disabledelayedexpansion
    
        set "build="
        for /f "tokens=3 delims=<>" %%a in (
            'find /i "" ^< "file.xml"'
        ) do set "build=%%a"
    
        echo %build%
    

提交回复
热议问题