batch renaming files using powershell
问题 I am able to batch rename files in a working directory by using: Dir | %{Rename-Item $_ -NewName ("0{0}.wav" -f $nr++)} However I want the file rename to start at something other than zero. Say 0500, and rename sequentially in order. Dir | %{Rename-Item $_ -NewName ("0{500}.wav" -f $nr++)} returns error. How can I tell rename to start at a number other than 0? 回答1: You can initialize the counter beforehand to 500. Also, you don't need to use a ForEach-Object loop ( % ) for this, because the