Quickly Rename File Formats: Custom Shell Menu Extension Guide

Written by

in

You can easily add a custom option to change file extensions directly from your Windows Right-Click (Shell) Menu by creating a simple registry script. This guide provides step-by-step instructions to set up a quick context menu shortcut, saving you from manually renaming files every time. Step 1: Prepare Your Batch Script

To make the context menu option work, you need a background script that handles the renaming process. Open Notepad (or any text editor). Paste the following batch script code into the document:

@echo off setlocal enabledelayedexpansion set “file=%~1” set “ext=%~x1” set /p “newext=Enter new file extension (e.g., txt, pdf): ” ren “%file%” “%~n1.!newext!” exit Use code with caution. Save the file as change_ext.bat.

Place this file in a permanent folder where it won’t be deleted, such as C:\Windows</code> or a dedicated scripts folder like C:\Scripts</code>. Step 2: Open the Windows Registry Editor

Windows requires a registry entry to link your new batch script to the right-click menu. Press Windows Key + R to open the Run dialog box. Type regedit and press Enter. Click Yes if a User Account Control (UAC) prompt appears. Step 3: Create the Menu Registry Keys Navigate through the registry to add the new menu action.

In the Registry Editor left sidebar, navigate to the following path:HKEY_CLASSES_ROOT*\shell

Right-click on the shell folder, hover over New, and select Key. Name this new key ChangeExtension.

Click on ChangeExtension. In the right pane, double-click the (Default) value.

Change the Value Data to Change File Extension. (This is the text that will appear in your right-click menu). Step 4: Link the Script Command

Now, tell Windows exactly what tool to launch when you click that menu option. Right-click the ChangeExtension key you just created. Select New > Key. Name this sub-key command (must be lowercase).

Select the command key. In the right pane, double-click the (Default) value.

Enter the path to your batch script using the following format:cmd.exe /c “C:\Scripts\change_ext.bat” “%1”(Note: Adjust C:\Scripts\change_ext.bat to match the exact location where you saved your file in Step 1). Click OK and close the Registry Editor. How to Use Your New Tool

The tool is immediately active without needing a system restart. Right-click any file on your computer.

Click Show more options (if you are on Windows 11) or look directly at the classic context menu. Click Change File Extension.

A command prompt window will flash open, asking you to type the new extension. Type the letters (e.g., png or txt) and press Enter.

If you want to customize this further, let me know if you would like to: Add a custom icon next to the menu text Modify the script to automatically hide the command window

Create an uninstaller script to safely remove this feature later

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *