How to remove or replace similar text from multiple files in windows using Windows PowerShell

There are times when you want to delete similar text from multiple files, if there are 1,2 it wouldn't act as a burden but what if there are 100's, 1000's of files.
E.g, You want to remove Module word from the below image. 
Like this suppose we have 100's of files it would definietly take several minutes to remove the similar word but why do that when we have powerful Windows PowerShell so let's get started.
First Open Windows Powershell using search bar or (Windows Key + X + A)
 
Now go to the files directory in which the files are located by typing
Now write the following code
get-childitem *.pdf | foreach { rename-item $_ $_.Name.Replace("Module", "") }
Now open the folder in which the files are located to see the result.
Similary if you want to replace text you can do it by the same code but by changing the code as
get-childitem *.pdf | foreach { rename-item $_ $_.Name.Replace("By xyz", "Hi") }
Here is the result

Comments