TheLeon, ну, вот Вам на WSH:
Код:
Option Explicit
Dim strSourceFile
Dim objXMLDOMNode
Dim objXMLDOMElement
strSourceFile = "C:\Мои проекты\0153\config.xml"
If WScript.CreateObject("Scripting.FileSystemObject").FileExists(strSourceFile) Then
With WScript.CreateObject("MSXML2.DOMDocument")
If .load(strSourceFile) Then
Set objXMLDOMNode = .SelectSingleNode("/Config/MediaPath[@Path='Vehicles']")
If objXMLDOMNode Is Nothing Then
Set objXMLDOMElement = .CreateElement("MediaPath")
objXMLDOMElement.SetAttribute "Path", "Vehicles"
.SelectSingleNode("/Config").appendChild objXMLDOMElement
Set objXMLDOMElement = Nothing
.save strSourceFile
Else
Set objXMLDOMNode = Nothing
End If
Else
WScript.Echo "Can't load source file [" & strSourceFile & "]."
WScript.Quit 2
End If
End With
Else
WScript.Echo "Can't find source file [" & strSourceFile & "]."
WScript.Quit 1
End If
WScript.Quit 0