|
Answer» Hi Guys,
I'm running into an ISSUE where an xml file is not read unless the number is higher than the locally cached xml file. I need this file read every day, so i'm looking for a batch file to increment the number by 1. I'll put this into a scheduled task so the file number increases daily.
The file name is: enterprise-sitelist.xml
The file contents are below:
Code: [Select]<rules version="2"> <emie> <domain exclude="false">URL1</domain> <domain exclude="false">URL2</domain> <domain exclude="false">URL3</domain> <domain exclude="false">URL4</domain> <domain exclude="false">URL5</domain> <domain exclude="false">URL6</domain> <domain exclude="false">URL7</domain> <domain exclude="false">URL8</domain> <domain exclude="false">URL9</domain> <domain exclude="false">URL10</domain> </emie> </rules>
Basically I just need rules version to be CURRENT +1You could probably do this with batch using brute force but using VBScript and the XML document object MIGHT be a whole lot easier.
Code: [Select]Set xmlDoc = CreateObject("Msxml2.DOMDocument") xmlDoc.async = False
xmlDoc.Load("enterprise-sitelist.xml") Set singleNode = xmlDoc.selectSingleNode("//rules")
singleNode.attributes.getNamedItem("version").text = singleNode.attributes.getNamedItem("version").text + 1
xmlDoc.save "enterprise-sitelist.xml"
Save the code with a VBS extension and run from the command prompt as cscript <scriptname>.vbs
Thank you very much! That works a charm.
Shaun
|