.replace と -replace はまったく同じものであるという印象を受けましたが、.replace では -replace で実行できる一部の RegEx タスクを実行できないことがわかりました。誰かが私が欠けているものを指摘してもらえますか?
Broken Regex replace:
$a=$a.Replace('.:\\LOGROOT\\', "\\$env:computername\logroot\")
Working Regex replace:
$a=$a -Replace('.:\\LOGROOT\\', "\\$env:computername\logroot\")
ps: 次の URL を見ると、よく知らない .replace オプションがあると思いますが、それらの使用方法やこれらのオプションのヘルプへのアクセス方法に関する追加情報が見つからないようです。http://www.computerperformance.co.uk/powershell/powershell_regex.htm Regex.Replace(String, String, String, RegexOptions) および Regex.Replace(String, String, MatchEvaluator, RegexOptions) メソッド。
ありがとうございました