我输入了这个:
$folder = 'c:\test'
"c:\test" -replace $folder ""
但出现此错误:
At line:1 char:25 + "c:\test" -replace $folder "" + ~~ Unexpected token '""' in expression or statement. + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : UnexpectedToken
这对我没有帮助 How to handle backslash character in PowerShell -replace string operations?
答案 0 :(得分:1)
您缺少逗号,我认为您有输入字符串和向后搜索字符串。
$folder -replace "test",""