Building an XML with Batch?

November 15, 2012 at 01:46:04
Specs: Windows 7, i5-2520M 2,50GHz / 4,00GB

Hey, i scan alot of documents and i'm saving them as .tif i only want the path from the tif and copy that into an XML file.

Now my batch script looks like this:

more header.txt >> Scan.xml
findstr /i "00000001.tif" INDEX.DAT >nul && echo "C:\Test\LS\00000001.tif" >>Scan.xml
more body.txt >> Scan.xml
findstr /i "00000001.tif" INDEX.DAT >nul && echo "C:\Test\LS\00000001.tif" >>Scan.xml
more footer.txt >> Scan.xml

and thats what in the scan.xml stands after i started the batch:

<Batch BatchClassName="Test" Priority="5">
<Document FormTypeName="FT_LS">
<IndexFields><IndexField Name="OrgFileName" Value=
<Pages><Page ImportFileName=

but the problem is that i get a random amount of scans and i dont want to make for each tif an own script, i want that the process runs automaticly, i guess this would be possible with an function to get the amount of tifs inside that folder and with that its maybe possible to make an automatic numbering function, but it also needs the header, body and footer txt to get the xml structure as seen above, but i honestly dont know how to pull this off since i dont work with batch very often, do you have any ideas what i could do to get this working?

See More: Building an XML with Batch?

Report •

November 15, 2012 at 07:40:57

First rule in combining XML and batch: Don't.
Second rule in combining XML and batch: Seriously, don't. There are a lot of scripting environments that'll handle XML. Some of them are even native to Windows, including VBScript, JScript, and PowerShell. Batch, however, is not one of them.

How To Ask Questions The Smart Way

Report •

November 15, 2012 at 11:10:28

what does index.dat look like? Is it binary or just text? maybe post a sample of it. Or is it just a directory listing, like: dir *.tif>index.dat

Report •

Related Solutions

Ask Question