Boost your productivity with PowerShell: Adding Prefixes to Multiple Files

Marcia SatieMarcia Satie
2 min read

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 /> ✧ ( • ᴗ - ) ✧

10
Subscribe to my newsletter

Read articles from Marcia Satie directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Marcia Satie
Marcia Satie

From Canvas to Command-lines Moving from art to coding, I'm fascinated by the idea of making life easier through technology, especially for myself. After years as a 2D animator, I wanted more challenges that could allow me to solve real-world problems creatively, motivating me to dive into this exciting new adventure of learning and innovation.