Wednesday, 15 February 2012

batch file to read ever element in my .xml -



batch file to read ever element in my .xml -

i'm trying utilize batch file read through elements of .xml file retrieve file path , execute them in order playlist. heres illustration of .xml file:

<sunday> <id>1</id> <filepath>\\movieserver\movie1.mkv</filepath> </sunday> <sunday> <id>2</id> <filepath>\\movieserver\movie2.avi</filepath> </sunday> <sunday> <id>3</id> <filepath>\\movieserver\movie3.avi</filepath> </sunday> <sunday> <id>4</id> <filepath>\\movieserver\movie4.avi</filepath> </sunday> </dataroot>

right i'm using batch file reads first element "\movieserver\movie1.mkv" how either loop through or line line pull out filepaths in order?

@echo off /f "tokens=2 delims=<>" %%a in ('type "c:\vlctv\vlcplaylists\programs\version_3.0\00-sun.xml" ^|find /i "<filepath>" ') set "var=%%a"

any suggestions appreciated :)

you have activate delayed expansion :

@echo off setlocal enabledelayedexpansion /f "tokens=2 delims=<>" %%a in ('type "c:\vlctv\vlcplaylists\programs\version_3.0\00-sun.xml" ^|find /i "<filepath>" ') ( set var="%%a" echo !var!)

batch-file

No comments:

Post a Comment