code_junkie

How can I search for a varying string in an XML file using VBS and replace it with another string

Nov 13th, 2011
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. <A>randomstuff</A>
  2.  
  3. <A></A>
  4.  
  5. <?xml version="1.0" encoding="UTF-8"?>
  6.  
  7. Set xml = CreateObject("Msxml2.DOMDocument.6.0")
  8. xml.Load "C:doc.xml"
  9. Set password = xml.SelectSingleNode("//root/element/password")
  10. password.Text = "Hello, world"
  11. xml.Save "C:doc.xml"
  12.  
  13. <root>
  14. <element>
  15. <password>Example password</password>
  16. </element>
  17. </root>
  18.  
  19. <?xml version="1.0" encoding="UTF-8"?>
  20.  
  21. <container name="root">
  22.  
  23. Set xml = CreateObject("Msxml2.DOMDocument.6.0")
  24. xml.Load "config.xml"
  25. Set password = xml.SelectSingleNode("//root/EIMServer/Global/OldConfig/K2097153")
  26. wscript.echo password.text
Add Comment
Please, Sign In to add comment