Use Windows PowerShell to Rename Files

Use Windows PowerShell to Rename Files

Q: How can I rename a large number of files by using Windows PowerShell?
A: I recently wanted to rename a portion of a large number of files. The best way I found to accomplish this was by using PowerShell, which made it very easy to rename only a specific part of the file name. The command I used is shown below:
 

get-childitem *.wmv | foreach {Rename-Item $_ $_.Name.Replace("oldstring","newstring")}

 

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish