替换 .bat 文件中的文本
我在名为 C:\durvi\mmi_test\mmidurvi 的文件夹中有 2 个文件夹,它们是 C:\durvi\mmi_test\mmidurvi\durvyauu C:\durvi\mmi_test\mmidurvi\sgdf
这两个文件夹都有 Connections.xml 文件
我想用 dd32261 替换任何出现的 ql99015
文件的示例格式如下
<pre><anyType xsi:type="xsd:string">ql99015</anyType>
<anyType xsi:type="xsd:string">ql99015_flowreeng_Anthony</anyType> </pre>
我尝试了如下但不起作用:
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..
)
提前感谢您的帮助!
I have 2 folders in folder called C:\durvi\mmi_test\mmidurvi which are
C:\durvi\mmi_test\mmidurvi\durvyauu
C:\durvi\mmi_test\mmidurvi\sgdf
Both these folders have Connections.xml file
I would like to replace any occurance of ql99015 with dd32261
A sample format of file is as below
<pre><anyType xsi:type="xsd:string">ql99015</anyType>
<anyType xsi:type="xsd:string">ql99015_flowreeng_Anthony</anyType> </pre>
I tried something like below but does not work:
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..
)
Thanks for your help in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将脚本更改为:
Change the script to: