【发布时间】:2016-09-10 06:40:06
【问题描述】:
我正在尝试替换文本文件中的一部分。 首先我搜索它是否存在于文本文件中
$check = Get-Content sample.txt | Where-Object {$_.Contains('<add key="IIS_VERSION" value="7" />')}
if ($checkIISv)
{
Write-Host "IIS's version is already 7"
}
else
{
Write-Host "Update IIS version to 7"
# I want to place here a code that will replace the value="7" if it is not =7
# This value is usually not 7
}
请帮忙,我认为这里不能使用替换功能,因为“值”被认为是未知的。
【问题讨论】:
标签: string powershell replace