-1
衍生我有一個這樣的XML文件:元素插入XML文檔從現有的內容
<game id="748" source="ScreenScraper">
<path>./Tecmo Super Bowl (U) (Sep 1993) [!].zip</path>
<name>Tecmo Super Bowl</name>
<desc>Tecmo returns to the gridiron with this new version of Tecmo Super Bowl for 16-bit console systems. Play with real National Football League players and teams in this 2D, side-scrolling arcade game.</desc>
<image>~/.emulationstation/downloaded_images/megadrive/Tecmo Super Bowl (U) (Sep 1993) [!]-image.png</image>
<rating>0.85</rating>
<releasedate>19930000T000000</releasedate>
<developer>Tecmo</developer>
<publisher>Tecmo</publisher>
<genre>Sports</genre>
<players>1-2</players>
<crc32>0F02FBFC</crc32>
<md5>FEC698E5387617B11C81431894B12EDC</md5>
<sha1>77AF672321947C3F8F80F7AE7ADFF8CDE0E2986A</sha1>
</game>
<game id="1014" source="ScreenScraper">
<path>./Action 52 (Unl) [!].zip</path>
<name>Action 52</name>
<desc>Action 52 features 52 different games in a single cartridge! The games are selected from one of three menus and are mostly side scrolling, platform or shooter action games.</desc>
<image>~/.emulationstation/downloaded_images/megadrive/Action 52 (Unl) [!]-image.png</image>
<rating>0.1</rating>
<releasedate>19930000T000000</releasedate>
<developer>Active Enterprises Ltd.</developer>
<publisher>Active Enterprises</publisher>
<genre>Compilation</genre>
<players>1-2</players>
<crc32>7B544625</crc32>
<md5>D32F3F2825DB4AE40D51317BBFF7330E</md5>
<sha1>3D9C1984B5F1B385EBDFF34218FEA6BCE83C43B6</sha1>
</game>
<game id="103612" source="ScreenScraper">
<path>./Bug's Life, A (Unl) [!].zip</path>
<name>A Bug's Life</name>
<developer>X BOY</developer>
<publisher>X BOY</publisher>
<genre>Action</genre>
<crc32>6EBECD9A</crc32>
<md5>27122254E417C44A35310E6D39B61D4A</md5>
<sha1>441A0E019EB32106D1AFD2ED97F117B007299F5B</sha1>
</game>
我需要一個批處理文件來爲每個遊戲讀取名字的值,並添加兩個新線這樣的每場比賽:
<video>~/.emulationstation/roms/megadrive/Videos/%gamename%.mp4</video>
<marquee>~/.emulationstation/roms/megadrive/Marquees/%gamename%.png</marquee>
凡%gamename%
必須<name>
和</name>
之間的遊戲的名稱。
我有此批處理腳本,但它不工作:
setlocal enableextensions disabledelayedexpansion
set "gamename="
for /f "tokens=3 delims=<>" %%a in ('find /i "<name>" ^< "gamelist.xml"') do set "gamename=%%a"
(for /F "delims=" %%a in (gamelist.xml) do (
set "newLine=!line:"~/.emulationstation/roms/megadrive/Videos/%gamename%.mp4"
echo !newLine!
)) > newFile.xml