diff --git a/replaceTag.ps1 b/replaceTag.ps1 new file mode 100644 index 0000000..9febbf3 --- /dev/null +++ b/replaceTag.ps1 @@ -0,0 +1,15 @@ +# 接收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 + +