How to Change/remove the part of the texts of FileName and replace the title of the Filename(.MKV) to the FileName itself

I know this is a strange requirement, but people out there if watching movies might need this when they share the movies through Media Player for streaming purpose.

We requires 2 paths to do this

  1. A PowerShell script to rename file and a batch script to click and run this PowerShell Script -> to rename the filename
  2. Foobar Software – a free opensource -> to rename the title of the file

The PowerShell script is as follows ( Copy Paste the below to your notepad and change the paramenters as required, Save the file as *.ps1 )

$dir = cmd /c dir /b
$dir | ForEach-Object { cmd /c ren $_ ($_ -replace ‘[|]’) }
Get-ChildItem *.mkv | Rename-Item -NewName { $_.Name -replace ‘www.yourfilename.change – ‘,” }
Get-ChildItem *.mkv | Rename-Item -NewName { $_.Name -replace ‘1080p’,” }
Get-ChildItem *.mkv | Rename-Item -NewName { $_.Name -replace ‘UNTOUCHED’,” }
Get-ChildItem *.log

Make sure you put the above file to the directory where u want to change the filenames, You can add as many lines on the above Get-Childitem with replace command to replace the required filename strings as you desires

Now the Batch File to run the Powershell script, as you dont want to copy paste the Powershell script to the powershell everytime, so copy the below command (dont forget to change the filename of the powershell with the name of yours) to a notepad and save it as *.bat file

PowerShell -NoProfile -ExecutionPolicy Bypass -Command “& ‘D:\Downloads\rename-ps.ps1′”

Now run the batch File and you will see the results.

Now the second part foobar2000, i am just putting the screenshots only

  1. Open Foobar
  2. Now click on File -> Add Files -> Select at the bottom filter by (All Files)
  3. Now right click the File

Once you Click on Properties below screen will appear and click on Tools and Click on Automatically Fill Values

As per the screenshot below change the pattern to %title% and then click ok Ok Save and you are Done

Attached below word document has the script file embedded inside the zip file, you can download and edit those file directly

Leave a comment