Batch file 替换.bat文件中的文本

Batch file 替换.bat文件中的文本,batch-file,dos,Batch File,Dos,我在名为C:\durvi\mmi\u test\mmidurvi的文件夹中有两个文件夹,分别是 C:\durvi\mmi\u测试\mmidurvi\durvyauu C:\durvi\mmi\u测试\mmidurvi\sgdf 这两个文件夹都有Connections.xml文件 我想用dd32261替换ql99015的任何事件 文件的示例格式如下所示 <pre><anyType xsi:type="xsd:string">ql99015</anyType>

我在名为C:\durvi\mmi\u test\mmidurvi的文件夹中有两个文件夹,分别是 C:\durvi\mmi\u测试\mmidurvi\durvyauu C:\durvi\mmi\u测试\mmidurvi\sgdf
这两个文件夹都有Connections.xml文件
我想用dd32261替换ql99015的任何事件
文件的示例格式如下所示

<pre><anyType xsi:type="xsd:string">ql99015</anyType>  

<anyType xsi:type="xsd:string">ql99015_flowreeng_Anthony</anyType>  </pre>
提前谢谢你的帮助

将脚本更改为:


谢谢,我会尝试一下,让你知道,非常感谢它工作得很好:),我刚刚添加了我在(connections.xml)do('s)中为/R c:\durvi\mmi_test\mmidurvi*%%a查找connections.xml'的路径
for /D %%f in (c:\durvi\mmi_test\mmidurvi\*) do (  
cd %%f  
if not exist "Connections.xml" (echo this file does not exist)&goto :eof  
SETLOCAL=ENABLEDELAYEDEXPANSION  
ren "Connections.xml" "Connections1.xml"  
for /f %%a in (Connections1.xml) do (    
set write=%%a  
echo %%a   
if !write!=="ql99015" set write="dd32261"  
echo !write! >> Connections.xml  
)  
del "Connections1.xml"  
cd..  
)  
SETLOCAL ENABLEDELAYEDEXPANSION
for /r %%a in (connections.xml) do (
  move "%%a" "%%a.temp"
  for /f "usebackq tokens=*" %%b in ("%%a.temp") do (
    set write=%%b
    echo !write:ql99015=dd32261! >> "%%a"
  )
  del "%%a.temp"
)