【发布时间】:2015-03-31 09:41:46
【问题描述】:
以下是我用来从 web.config 文件中删除父节点的 powershell 代码:
$c = "C:\test\web.config"
$xml = ( Get-Content $c)
$ConnectionString = $xml.configuration.appSettings.add | Where-Object {$_.Key -eq 'ConnectionString'}
$xml.configuration.RemoveChild($ConnectionString.ParentNode)
$xml.save($c)
After removing <appSettings> tag from web.config file. Some special Characters like 
 are adding to web.config file as below:
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, 
 System.Web.Extensions, Version=3.5.0.0, Culture=neutral, 
 PublicKeyToken=31bf3856ad364e35">
</configSections>
</configuration>
请告诉我如何保存不带&#xA; 和换行等特殊字符的xml 文件
【问题讨论】:
标签: xml powershell powershell-ise cmdlet