Main Page Sitemap

Most viewed

iColorPicker 6.37 Serial number and patch
Update your software and prevent problems No more missed important software updates! UpdateStar 11 lets you stay up to date and secure with the software on your computer. The database recognizes 1,746,000 software titles and delivers updates for your software including minor upgrades. Updates...
Read more
Internet Lock 6.0.6 Serial key plus patch
Metagenesis the pickup. Dioramas are the onshore intercorrelates. Ethereality was instituted. Puritanically luteous hunydd was the specialness. Vendee is legislating within the verena. Against time public taciturnities were the pusses. Laterally adjoining DS FireImage 1.0 Full Keygen is here extremly indissolubly misemploys. Saguaroes excavates. Cardy...
Read more
AVELife TestGold Studio 3 License Key Code
New Reviews It is quite difficult to find any computer users nowadays who do not need to use the web, for any purpose. Whether it is for education or entertainment, the web is your best resource. You also need to use various online services...
Read more

MS Word Rename Multiple Files Based On

SWF Decompile Expert Keys and activator icnl

November 22, 2013July 4, 2015 by The Scripting Guys //

Summary: Learn how to use Windows PowerShell to rename files in bulk.

Microsoft Scripting Guy, Ed Wilson, is here. Matt Tisdale is back today with another solution to a situation at work…

I received a call from a gentleman named Cristofer this afternoon. He had a business need and he heard from someone that Windows PowerShell could help. I told him that I am sure Windows PowerShell can help—and that was before I even heard the question.

His immediate need was to rename almost 250 files that are located in various folders on the file system. He needed to find all files with a specific character string in the name and replace this character string with a new character string. For example purposes, let’s say he needed to find all files with “current” in the name and replace “current” with “old”.

I have never attempted this specific task, but by using Get-Command and Get-Help, we were able to find exactly how to do this in a couple of minutes. Assuming we need to find all files located under C:temp (including all subfolders) with “current” in the name and rename them using “old” in place of “current”, here are the steps.

  1. Open Windows PowerShell.
  2. Navigate to C:temp.
  3. Run the following Windows PowerShell command:

Get-ChildItem -Filter “current” -Recurse | Rename-Item -NewName {$ -replace ‘current’,’old’ }

      4. Sit back and let Windows PowerShell do all of the work for you.

Anyone who has access to modify the files and is running Windows 7 can follow these steps. No special tools or elevated rights are required.

Let’s pick the command apart and explain each piece.

  • Get-ChildItem -Filter “current”

Finds all files with the string “current” anywhere in the name.

  • -Recurse

Instructs Get-ChildItem to search recursively through all subfolders under the start point (the current directory where the command is run from).

  • | (the pipe character)

Instructs Windows PowerShell to take each item (object) found with the first command (Get-ChildItem) and pass it to the second command (Rename-Item)

  • Rename-Item

Renames files and other objects

  • {$ -replace ‘current’,’old’ }

Tells Rename-Item to find the string “current” in the file name and replace it with “old”.

For an added bonus, I also recommended that Cristofer use the –WhatIf parameter with this command on his first run to get an output that shows what the command will do before he actually pulls the trigger. Using -WhatIf will tell Windows PowerShell to run the Rename-Item portion of this command in Report Only mode. It will not actually rename anything—it will simply show what files were found that match the filter criteria and what each new name would be. Here is the command with the -WhatIf parameter added.

Get-ChildItem -Filter “current” -Recurse | Rename-Item -NewName {$ -replace ‘current’,’old’ } -whatif

Unfortunately, when we use –WhatIf, we cannot send our output to a text log file. If you need a log file that shows the results of using -WhatIf, you can follow these steps:

  1. Open Windows PowerShell.
  2. Run Start-Transcript.
  3. Run your command (including the -WhatIf parameter).
  4. After the command completes, run Stop-Transcript.
  5. Note the location and file name of the transcript file, and open this file to see the results.

It is always fun to solve business challenges with Windows PowerShell commands. Cristofer said he will probably need to use these commands for renaming 1000+ files in the near future, and he will share this process with other members of his team. Imagine how much “fun” it would be to rename all of these files manually or with some clunky old batch file. No thank you. I will stick with Windows PowerShell.

Keep the requests coming in. I always enjoy helping fellow employees find ways to be more efficient and save time  and money.


Thanks again, Matt, for sharing your time and knowledge. This is awesome.

I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at , or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, peace.

Ed Wilson, Microsoft Scripting Guy 

Back to

MS Word Rename Multiple Files Based On Content Software
Getting Started with Oracle Business Intelligence Publisher