How to rename multiple files?

Chloe Jarman 26 Reputation points

Hi all,

I need to make multiple files in one folder (C:\Users\Desktop\BMS\Siemens Data) change from being the Type of file : File to a Type of file: Text Document (.txt). How do I do that using powershell?

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,427 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Chris 656 Reputation points

  2. Chris 656 Reputation points

    ren . *.txt

    0 comments No comments

  3. Chris 656 Reputation points

    you need two stars, but editor remove my star in my example

    ren star.txt

    0 comments No comments

  4. js2010 186 Reputation points

    If I understand you correctly, this is very common. Take off the -whatif if it looks right. Added parentheses so the first part finishes before the second part.

    (get-childitem -file) | rename-item -newname { $ + '.txt' } -whatif
    What if: Performing the operation "Rename File" on target "Item: C:\users\js\foo Destination: C:\users\js\foo.txt".