DOS batch command to read some info from text file

后端 未结 5 927
醉话见心
醉话见心 2021-01-19 03:16

I am trying to read some info from a text file by using windows command line, and save it to a variable just like \"set info =1234\"

Below is the content of the txt

5条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-19 03:47

    Use the for command to parse the file:

    for /f "skip=4 tokens=2" %%l in (svninfo.txt) do (
        set revision=%%l
        goto gotrev
    )
    
    :gotrev
    echo revision is %revision%
    

提交回复
热议问题