批处理把字符串插入到xml指定位置 - 洛阳翼展电脑


批处理把字符串插入到xml指定位置

2023-9-17 乱云飞

@echo off
setlocal enabledelayedexpansion
set "inputFile=config.ini"
set "outputFile=onvif.ini"
set "insertString=rtsp://127.0.0.1:8554/screenlive+audiodevice"
set "targetStartTag=<stream_uri>"
set "targetEndTag=</stream_uri>"
set "insertLine=%targetStartTag%%insertString%%targetEndTag%"
(
  for /f "delims=" %%I in ('type "%inputFile%" ^& echo/') do (
    set "line=%%I"
    if "!line!"=="!line:%targetStartTag%=%!" (
      echo %%I
    ) else (
      echo !insertLine!
    )
  )
) > "%outputFile%"
echo Done!
本文链接:http://80c.cc/ez/699.html
0

发表评论:

VirtualCamera:在录像机中虚拟一个通道显示电脑桌面、视频文件、USB摄像头~
预ICP备10086-001号 © 翼展网/80C.CC 技术支持/洛阳翼展科技
TEL / 13213610060 QQ / 345794501
Powered by emlog