1
我必須複製一個文件名的文件如下複製項目與文件名奇怪的字符(即[])
$filename = "Sport.EL#15.csv.[]"
到另一個文件夾。
如果我使用
copy-item -force Sport.EL#15.csv.[] $dest_path
這是行不通的。
,因爲我這樣做:
foreach ($f in Get-ChildItem $pathfile | Where {!$_.PsIsContainer} | Where {$_.Name -match $filename}){....}
,誤差
Bad argument to operator '-match': parsing "Sport.EL#15.csv.[]" - Unterminated [] set..
我認爲這個問題是[]中的文件名。我該如何解決?
太棒了,它的工作原理。但我可以解決我的foreach問題.... - 匹配? – rschirin
@rschirin編輯我的答案添加一個技巧,讓我知道... –
太棒了!它完美的工作!!!!謝謝 – rschirin