How to rename files with "find and replace" function?

Question:

How to rename files with "find and replace" function?

Solution:

You need create 2 files with your Notepad.

File 1 is a *.ps1 file, which is going to be used by Windows Powershell.exe.

Content in File 1:

cd "PATH"

dir | Dir | Rename-Item –NewName { $_.name –replace “FIND“,”REPLACE” }

File 2 is a *.bat file, which is the batch file to be used with Windows CMD.exe

Content in File 2:

@echo off

Powershell.exe -executionpolicy remotesigned -File PATH\XXX.PS1

exit