Boost your productivity with PowerShell: Adding Prefixes to Multiple Files

Boost your productivity with PowerShell: Adding Prefixes to Multiple Files

About Powershell

PowerShell is a command-line tool by Microsoft for managing and automating tasks in Windows. It lets users control and configure their computers through commands and scripts, making tasks like file management and system administration easier and more efficient.

Is also quite powerful for file manipulation tasks, including renaming multiple files, or in this case, adding the same Prefix for numerous files.

Adding Prefix for multiple files at once:

  1. Add all the files (that you want to rename) to the same folder.

  2. Open Powershell:

    .(Windows 11) To open Powershell press "Windows key + x", this will open Power Options. Then Select "Terminal"

    .(Windows 10) Hit the Windows + R to open the Run dialog box and type PowerShell in the text box. You may either hit "OK" or "Enter".

Navigate to the Directory: Use the cd command (file's path) to navigate to the directory containing the files you want to rename and press Enter. For example:

How to get the file
cd C:\Path\To\Your\Files
  1. Then type the code below, replacing Prefix with the prefix you want to add (example: {"banana"+ $.Name}), and press Enter.
$items=Get-ChildItem;
$items | Rename-Item -NewName { "Prefix" + $_.Name };

Done all the images will be re-named.

If you have more tips on how to improve your productivity using Powershell leave a comment, I would love to try it!

And...

< Tag along /> ✧ ( • ᴗ - ) ✧

Did you find this article valuable?

Support Marcia Satie by becoming a sponsor. Any amount is appreciated!