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 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:\
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’}
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_’.
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
TeraBlitz Steam Header Custom Grid Gloss Pack Download
Related Posts
- How to batch rename files with Windows PowerShell command script
- How to redirect or force websites from HTTP to HTTPS via .htaccess
- How to bulk delete WordPress posts in a category via SQL
- How to change the WordPress Administrator User ID
- How to Clean a Dirty PC DIY
- How To Speed-Up Libre Office Startup and Disable the Splash Screen
Hot Topics
- ProjectAlpha Mod unleashes the new KLA army for Red Alert 2!
- PROJECTALPHA – Legendary RA2 Mod Returns with a New Twist
- Speed Notes released: the ultimate note-taking app for desktop
- TeraBlitz Matrix Green: Unveiling the ultimate Rainmeter skin
- TeraBlitz Geeks releases Holy Bible Desktop Lite for Windows
- Patch 1.1 released for The Walking Horde A20.6 mod
- The Walking Horde Overhaul Mod released for PC
- Blitz Republic Mod now available for download via Steam Workshop
- Blitz Republic Rise of Nations Mod ready for August 2021 release
- Top Notepad alternatives in Windows 10 for 2021
- Best Social Media alternative App downloads 2021
- How to post to Instagram via Desktop Browser
- Quick Fix: Night of the Dead black screens, lags and crashes
- Quick Fix: Fixing Red Alert 2 alt+tab issue in Windows 10
- ABZU Rogue Company Rocket League and Rising Storm 2 Vietnam now free!
- How to batch rename files with Windows PowerShell command script
- How to redirect or force websites from HTTP to HTTPS via .htaccess
- How to bulk delete WordPress posts in a category via SQL
- Ultimate PUBG survival manual with tips, tricks and secrets
- How to change the WordPress Administrator User ID
- Quick Fix: Remove or Hide CS GO Steam Player Profile Picture or Avatar
- Google Hangouts Chat Easter Eggs Cheat Sheet 2018
- Freeware Review: QTTabBar
- Tech News: World of Warcraft Battle for Azeroth Expansion
- Tech News: StarCraft 2 goes Free
- Cossacks 3 PC Cheats Codes Secrets
- Act of War Direct Action PC Cheats Codes Secrets
- TeraBlitz Com plays CSGO De_Dust2 April 3, 2016 A
- Blender 3D Commands – Keyboard Shortcuts Cheat Sheet
- Adam’s Venture Origins PC Cheats, Codes and Secrets
- Games Release News: Adam’s Venture: Origins
- Samsung S7 Tech Sheet
- Hebrew Alphabet and Characters Cheat Sheet
- TeraBlitz Com plays CSGO De_Dust2 April 3, 2016 B
- Japanese Hiragana Alphabet and Characters Cheat Sheet
- Ultimate HTML Entities and Character Reference Cheat Sheet
- Japanese Katakana Alphabet and Characters Cheat Sheet
- CAT5 – CAT6 Color Scheme Wire Combination Cheat Sheet
- Ubuntu Linux Versions Release Cheat Sheet
- Tech News: Ubuntu Linux releases 16.04 LTS Beta 2
- Apple iPhone SE Tech Sheet
- Freeware Review: Panda USB Vaccine
- Games Release: Total War Battles: KINGDOM
- Games Release: StarCraft 2 Nova Covert Ops Mission Pack 1
- Tech News: Heroes of the Storm to add Lost Cavern map
- Games Release: Dawn of Steel for Windows devices
- Quick Fix: Remove or Hide CS GO Hud for Screenshots
- Quick Fix: CS GO Missing Crosshair
- Warcraft 3 PC Cheats, Codes and Secrets
- Tech News: Blizzard’s Warcraft 3 patch 1.27a release notes