You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

15 lines
473 B

# 接收4个参数,用于替换 参数1 文件中的 参数2:参数3 为 参数2:参数4
param (
[string]$filePath,
[string]$key,
[string]$oldValue,
[string]$newValue
)
# 替换 $filePath 文件中的 $key:$oldValue 为 $key:$newValue
Write-Output "replace $filePath ${key}:$oldValue to ${key}:$newValue then save to $filePath"
(Get-Content $filePath) -replace "${key}:$oldValue", "${key}:$newValue" | Set-Content $filePath
Get-Content $filePath