How to batch rename files with Windows PowerShell command script
How to batch rename files with Windows PowerShell command script. This How-To guide will help you rename in bulk the files in Windows Operating System using scripting via Windows PowerShell. The script is specially useful when renaming files like multiple MP3s, JPGs,

PNGs, or TXTs in a folder. Windows PowerShell is a shell created for Microsoft Windows mainly used by IT Administrators for automating tasks and system management. Based on the .Net framework, PowerShell is a more powerful command-line tool with associated scripting language compared to the classic Command Prompt.How to batch rename files with Windows PowerShell command script

 

How to batch rename files with Windows PowerShell command script

➤ How to batch rename files with Windows PowerShell command script details
    • To invoke Windows PowerShell in Windows, you can type

‘powershell’

    • in the search box. Using the Run dialog

(Windows + R)

    , you can also type-in the same ‘powershell’ command. For ease of use in Windows 7, you can open it by clicking Accessories in the Start Menu, then hit PowerShell. For Windows 8.1 or 10, look for the Windows PowerShell folder then hit the PowerShell executable.
Note: You can also rename your files in bulk using the old-reliable MS-DOS command-line. To rename files in Windows using CMD, you can either use ‘ren’ or ‘rename’ then use * and ? for wildcards and file matching. However, this article focuses mainly on Windows PowerShell and it’s ability to perform complex tasks such as batch file renaming.
First off, change your directory to where the files are located by using the ‘Set-Location -Path’ command:
Set-Location -Path C:\
You can change the path to your desired folder for example:
Set-Location -Path C:\Users\your_username\Desktop
Although changing to another drive is a much faster route. Just type in the desired drive letter. Let’s say from drive ‘D:\’ you change it to ‘C:\’
C:\

How to batch rename files with Windows PowerShell command script

How to batch rename files with Windows PowerShell command script
 
Tip: Make sure to enclose the path in quotes if they contain spaces.
After setting your desired folder where the files are residing, complete the batch file renaming process by using the script below:

$filter = ‘*.png’

get-childitem -path $path -filter $filter | rename-item -newname {$_.name -replace ‘old_name’,’new_name’}

This is assuming that ‘.png’ is your file type. You can modify this to your desired file type such as ‘.mp3’, ‘.jpg’ or ‘.bmp’. Finally, change the ‘old_name’ and ‘new_name’ as intended. In our example, we used ‘terablitz_old_name_’ and changed it to ‘terablitz_new_name_’.

How to batch rename files with Windows PowerShell command script

How to batch rename files with Windows PowerShell command script
 
Let me know how if this worked out for you. Please do not forget to post your comments below.
posted May 13, 2018 by THE11thROCK for TeraBlitz.com
FAIR USE DISCLAIMER: The following data is for educational, scholarship review and archiving purposes only. By viewing this information, you release the website and its authors from any responsibility or liabilities. Though we verify and maintain the accuracy of the provided data, the absence of unintented typographical and factual errors cannot be guaranteed. Use the page at your own risk. For any suggestions, updates, credits or correction requests, Contact Us: terablitz.rock@gmail.com