1
$xmlFile = "D:\ServiceConfiguration.cscfg"
[xml]$doc = Get-Content $xmlFile
$node = $doc.SelectSingleNode("/ServiceConfiguration/Role/ConfigurationSettings[@name='DiagnosticsConnectionString']")
$node.value = "New-Value"
$doc.Save($xmlFile)
SelectSingleNode总是返回null。请帮助电源外壳脚本SelectSingleNode不工作
你的XPath是错误的或者有在cscfg文件中使用的命名空间。没有输入文件很难回答.. – stej 2011-04-12 11:59:21