Monday 4 April 2016

Batch file rename using Powershell

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.
Dir | Rename-Item –NewName { $_.name –replace “ “,”_” }