$Directory = "C:\Test" For($i=0;$i -le 10; ++$i) { Set-Content -Path $("$Directory\Test($i).txt") -value $i }
建立結果以下圖:
html
PS D:\> $Directory = "C:\Test" PS D:\> Get-ChildItem $Directory | Rename-Item -NewName { $_.name -Replace "Test","Mail" }
結果以下圖:
shell
http://www.computerperformance.co.uk/powershell/powershell_replace.htm
http://www.pstips.net/bulk-renaming-files.htmlmarkdown