Adding a batch script to the Windows Context Menu

With my previous article on How to remove the metadata title from MKV files I discussed methods for using a simple batch file to process a folder, removing metadata from individual files, plus an option to do this recursively; this got me thinking how great it would be to add that to the right-click menu for Windows folders.

As it turns out, it’s really easy, and using the example of recursively processing all MKV files in a folder structure, this is how…

Save the following to a file called MKVCleanup.bat, place this in your Windows folder (Usually c:\windows). You can download a copy by right-clicking here, and selecting “Save As”.

@echo off
cd %1
for /r %%i in (*.mkv) do (
echo processing "%%i"
"C:\Program Files\MKVToolNix\mkvpropedit.exe" "%%i" -d title
)
Echo Done.
pause

The next step, actually adding the right-click command is a registry addition; save the following text into a file on your desktop called MKVCleanup.reg, then right-click on it, selecting “Merge”. You can download a copy by right-clicking here, and selecting “Save As”, you’ll still need to right click on it, selecting merge. This makes an entry in HKEY_CLASSES_ROOT\Directory\shell – it just includes a title, and one command which points to the batch file.

It takes advantage that the environment automatically starts in parent of the folder indicated by your right click, and passes the target folder as a command line parameter.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\MKVCleanup]
@="&MKVCleanup"

[HKEY_CLASSES_ROOT\Directory\shell\MKVCleanup\command]
@="\"C:\\Windows\\MKVCleanup.bat\" \"%1\""

If you’re actually using this, you’ll also need the MKVToolNix Program (Backup link to 64 bit installer, since their site seems to be down a lot). Go download and install. It’s free, and doesn’t nag.

That’s it, no reboot required, as soon as you’re done, you’ll have a new & shiny right click option in Windows Explorer for folders called “MKVCleanup” – simples 🙂

One thought on “Adding a batch script to the Windows Context Menu

  1. Pingback: How to remove the metadata title from MKV files | @Spabbit

Words of wisdom?