Remove First Few Characters from Multiple Files at Once [Windows]

I had 78 markdown files (.md) in format and I wanted to remove the date from all the files at once. And, the final format should be like format.

Renaming all the files one-by-one manually would take ages, and after researching a bit I found the perfect solution that I needed.

I was able to remove the first 11 characters (to remove the date from the filenames) from all the 78 .md files in the folder.

Let me explain everything step-by-step:

Remove the First Few Characters from Multiple Files at Once in Windows 10

How to remove the first few characters from multiple files at once in Windows

I might not be able to describe properly, but it’s actually very easy.

Step 1 – Open the destination folder

First, open the folder where those files are located.

Press and hold the button shift and then right-click anywhere in the folder and select Open PowerShell window here option.

A new window will pop open and then proceed to the next step.

I’m on Windows 10 but for some older Windows, you might see CMD or Command Prompt instead of PowerShell.

Step 2 – Run the Command

Before running the command, it’s important to know what type of files you would be renaming – is it a .txt file? .mp4, .md, .docx, or any other.

Also, you need to count the number of characters you would remove from the left side. Please note that a dash or space in the filename would also be counted as 1 character.

Now that you know:

  • file extension (.mp4, or .txt, .docx, or any other)
  • the number of characters to trim from each file

It’s time to run the following command (but do not forget to edit before running):

get-childitem *.txt | rename-item -newname { [string]($ }

Assumption: If you have multiple text files (.txt) and want to remove the first 5 characters from the filename, then only the above command will work.


Let’s assume you have multiple image files (.jpeg) in the folder and you want to remove the first 2 characters from the start then the command would be:

get-childitem *.jpeg | rename-item -newname { [string]($ }

And, that’s it.

Within seconds, all your files will be renamed.

Please note that this process is irreversible, so I would recommend that you copy all the files to another folder and then try running these commands to avoid any mistakes.

Also, please note that this trick will work for files of the same extension. If you have to rename multiple files, you can repeat the process for each type of files.

If you get stuck somewhere, please let me know in the comments below.