$100 = "$env:APPDATA/somthing"
$iamhere = "C:/example"
$100 = $100 -replace "`$env:APPDATA\somthing", "$iamhere"
尽管我收到此错误,但我想$100
替换$iamhere
为它的内容(以文本形式)。
Regular expression pattern is not valid: $env:APPDATA\somthing.
At line:1 char:1
$100 = $100 -replace "`$env:APPDATA\somthing", "$iamhere"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: ($env:APPDATA\somthing:String) [], RuntimeException
+ FullyQualifiedErrorId : InvalidRegularExpression
我认为这是因为我试图用目录替换一些文本,但我想要变量中的文本$iamhere