Board logo

标题: [文本处理] 求助:批处理将A文件中的指定内容替换B文件中的指定内容 [打印本页]

作者: billyyang    时间: 2013-1-1 13:52     标题: 求助:批处理将A文件中的指定内容替换B文件中的指定内容

现有A.xml,
内容为
<?xml version="1.0" encoding="UTF-8"?>

<theme-config name="你好" en_name="nh" ver="1.0" id_flag="nh_938395" version="1">

  <workspace>

    <textcolor>#333333</textcolor>

    <textsize>14</textsize>

    <textbackcolor>#444444</textbackcolor>

    <background>aaa/bbb/wallpaper.jpg</background>

  </workspace>

  <drawer>

    <textcolor>#555555</textcolor>

    <textsize>13</textsize>

    <background>aaa/bbb/image.jpg</background>

  </drawer>
B.xml的内容为
<?xml version="1.0" encoding="UTF-8"?>
<theme-config name="爱情" en_name="love" ver="1.0">
  <workspace>
    <textcolor>#000000</textcolor>
    <textsize>14</textsize>
    <textbackcolor>#111111</textbackcolor>
    <background>aaa/bbb/wallpaper.jpg</background>
  </workspace>
  <drawer>
    <textcolor>#222222</textcolor>
    <textsize>13</textsize>
    <background>aaa/bbb/image.jpg</background>
  </drawer>

B.xml的内容是固定的,
现在需要根据取出A.xml中的“你好”,#333333,#444444,#555555替换B.xml中“爱情”,#000000,#111111,#222222的内容。使B.xml中的上述内容和A.xml一样。因为A.xml文件中的数值内容不是固定的。
要用bat批处理,另外a和b还有一些代码是不一样的。
作者: BAT-VBS    时间: 2013-1-1 14:25

你的xml文件如果不是ANSI编码的话,BAT处理起来不方便。




欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2