2013-04-23 68 views
2

如何重命名文件?Powershell使用通配符重命名文件

Cf.EL#131.csv.[daily_report+cf.com] 

其中.com是擴展名。

當我試試這個:

$file='Cf.EL#131.csv.[daily_report+cf.com]' 
Rename-Item $file pippo.txt 
+0

你想使用通配符? – 2013-04-23 16:19:14

回答

3

Rename-Item cmdlet不具有LiteralPath參數,它是你需要在這種情況下,因爲什麼文件路徑在方括號被用於每個字符類POSIX標準。因此,作爲解決方案使用Move-Item

Move-Item -LiteralPath $file -Destination pippo.txt 
相關問題