Jump to content

how to glean a line from an xml doc


Recommended Posts

I have been working on a batch file to keep antivirus def's up to date for CLI scanning. I've managed to get the info in a couple of xml files, but need to glean one line in each of them and insert the text into my batch file...

  <?xml version="1.0" encoding="ISO-8859-1" ?> 
- <response>
- <return>
<code>0</code>
<desc>Valid key</desc>
</return>
- <servers>
<item weight="10">srv3.directupdates.f-prot.net</item>
<item weight="1">files.directupdates.f-prot.net</item>
</servers>
- <components>
- <item type="deffile">
<name>antivir.def</name>
<path>/files/defs/v.6/20090724-1439-9c1722e1078540975dd26505a1e775f8/antivir.def</path>
- <uniqid>
<item type="defid">200907241350b1f2eda5b9dce3692bea07b283f093ef</item>
<item type="md5">3adf20033f9d7654d1de9fca2a365e64</item>
<item type="sha1">d8fe7d15f9534ceb31f84083a02c2c34f5b5e34c</item>
<item type="size">40361941</item>
</uniqid>
</item>
</components>
<programversion />
<timestamp utime="1248474272">2009-06-24 22:24:32</timestamp>
</response>

In this case, I want this line...

/files/defs/v.6/20090724-1439-9c1722e1078540975dd26505a1e775f8/antivir.def

to be concatenated to my batch file as it changes every day.

Would someone mind making a suggestion as to how I can accomplish this?

TIA.. aj

Link to comment
Share on other sites


Cuz I don't know VB. I can barely do a batch script with download.exe and wget.exe. They work great though for what I need. I've had one that I've tweaked for years now.

I don't know how to start learning how to make VB scripts but am willing to learn.

Thanks...

btw i think i used your batch script once upon a time to download windows updates.

Link to comment
Share on other sites

I have been working on a batch file to keep antivirus def's up to date for CLI scanning. I've managed to get the info in a couple of xml files, but need to glean one line in each of them and insert the text into my batch file...

@For /f "tokens=3 delims=<>" %%# In ('Find "<path>"^<your.xml') Do @Echo %%#

Change your.xml to the proper name and Echo to whatever you need to do with your content %%#.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...