How to rename multiple files?

Chloe Jarman 26 Reputation points
2021-02-17T16:36:36.947+00:00

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 for business | Windows Server | User experience | PowerShell
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Chris 656 Reputation points
    2021-02-17T16:54:26.197+00:00

  2. Chris 656 Reputation points
    2021-02-17T17:14:17.873+00:00

    ren . *.txt

    0 comments No comments

  3. Chris 656 Reputation points
    2021-02-17T17:16:06.133+00:00

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

    ren star.star star.txt

    0 comments No comments

  4. js2010 191 Reputation points
    2021-02-17T20:54:22.7+00:00

    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 { $_.name + '.txt' } -whatif
    
    What if: Performing the operation "Rename File" on target "Item: C:\users\js\foo Destination: C:\users\js\foo.txt".
    

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.