top of page

How to Batch Rename Files in Windows

  • Writer: skarbnik
    skarbnik
  • Jul 17, 2016
  • 1 min read

PowerShell

PowerShell offers much more flexibility for renaming files in a command-line environment. Using PowerShell, you can pipe the output of one command – known as a “commandlet” in PowerShell terms — to another command, just like you can on Linux and other UNIX-like systems.

The two important commands you’ll need are Dir, which lists the files in the current directory, and Rename-Item, which renames an item (a file, in this case). Pipe the output of Dir to Rename-Item and you’re in business.

After you launch PowerShell, use the cd command to enter the directory containing your files. You should put the files in their own directory so you don’t accidentally rename other files.

For example, let’s say we don’t want the space character in our file names – we’d rather have an underscore instead.

The following command lists the files in the current directory and pipes the list to Rename-Item. Rename-Item replaces each space character with an underscore.

Replace the “ “ and “_” parts of the command to replace other characters in file names.

Consult Microsoft’s documentation on the Rename-Item commandlet if you want help performing other, more advanced operations.

Comments


Search By Tags
bottom of page