Apps Add or Remove Open with Context Menu to BAT files in Windows 11


  • Staff
Open_with_banner.png

This tutorial will show you how to add or remove Open with to the context menu of BAT files for all users in Windows 10 and Windows 11.

A .bat file is a batch file that consists of a series of commands to be executed by the command line interpreter, stored in a plain text file.

BAT files do not include Open with in their context menu by default in Windows.

If you like, you can add Open with to the context menu of .bat files that allows you to choose an app to open the BAT file with just once.


You must be signed in as an administrator to add or remove the "Open with" context menu for BAT files.



EXAMPLE: "Open with" context menu for BAT files

You will need to click/tap on Show more options first by default, then click/tap on Open with.



Show_more_options.png
BAT_Open_with.png



Here's How:

1 Do step 2 (add) or step 3 (remove) below for what you would like to do.

2 Add "Open with" context menu to BAT files for All Users

This is the default setting.


A) Click/tap on the Download button below to download the file below, and go to step 4 below.

Add_Open_with_to_BAT_context_menu_for_all_users.reg


(Contents of REG file for reference)
Code:
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\batfile\shell\Open with\command]
@="{09799AFB-AD67-11d1-ABCD-00C04FC30936}"

3 Remove "Open with" context menu from BAT files for All Users

A) Click/tap on the Download button below to download the file below, and go to step 4 below.

Remove_Open_with_from_BAT_context_menu_for_all_users.reg


(Contents of REG file for reference)
Code:
Windows Registry Editor Version 5.00

[-HKEY_CLASSES_ROOT\batfile\shell\Open With]

4 Save the .reg file to your desktop.

5 Double click/tap on the downloaded .reg file to merge it.

6 When prompted, click/tap on Run, Yes (UAC), Yes, and OK to approve the merge.

7 You can now delete the downloaded .reg file if you like.


That's it,
Shawn Brink


 

Attachments

  • Open_with.png
    Open_with.png
    1.9 KB · Views: 59
  • Add_Open_with_to_BAT_context_menu_for_all_users.reg
    626 bytes · Views: 203
  • Remove_Open_with_from_BAT_context_menu_for_all_users.reg
    524 bytes · Views: 202
Last edited:
To add the "Edit" option to the right click menu for a .bat file, add this to the registry:
HKEY_CLASSES_ROOT\batfile\shell\edit\command
C:\Users\[NAME]\AppData\Local\Microsoft\WindowsApps\notepad.exe %1

Substitute the actual user name for [NAME]
Note that the key is batfile and not simply .bat
Given that path, this should use the newer version of Notepad.exe as well unless the newer version is saved elsewhere, in which case use the appropriate path for it adding the " %1" at the end of the path.
 

My Computer

System One

  • OS
    Windows 11 Home
To add the "Edit" option to the right click menu for a .bat file, add this to the registry:
HKEY_CLASSES_ROOT\batfile\shell\edit\command
C:\Users\[NAME]\AppData\Local\Microsoft\WindowsApps\notepad.exe %1

Substitute the actual user name for [NAME]
Note that the key is batfile and not simply .bat
Given that path, this should use the newer version of Notepad.exe as well unless the newer version is saved elsewhere, in which case use the appropriate path for it adding the " %1" at the end of the path.
Hello, and welcome. :alien:

Edit should be in the Shift+Right Click context menu of BAT files by default.

You would want to use:

%SystemRoot%\System32\NOTEPAD.EXE %1

Instead of:

C:\Users\[NAME]\AppData\Local\Microsoft\WindowsApps\notepad.exe %1

BAT_edit.jpg
 

My Computers

System One System Two

  • OS
    Windows 11 Pro for Workstations
    Computer type
    PC/Desktop
    Manufacturer/Model
    Custom self build
    CPU
    Intel i7-8700K 5 GHz
    Motherboard
    ASUS ROG Maximus XI Formula Z390
    Memory
    64 GB (4x16GB) G.SKILL TridentZ RGB DDR4 3600 MHz (F4-3600C18D-32GTZR)
    Graphics Card(s)
    ASUS ROG-STRIX-GTX1080TI-O11G-GAMING (11GB GDDR5X)
    Sound Card
    Integrated Digital Audio (S/PDIF)
    Monitor(s) Displays
    2 x Samsung Odyssey G75 27"
    Screen Resolution
    2560x1440
    Hard Drives
    1TB Samsung 990 PRO M.2,
    4TB Samsung 990 PRO M.2,
    8TB WD MyCloudEX2Ultra NAS
    PSU
    Seasonic Prime Titanium 850W
    Case
    Thermaltake Core P3 wall mounted
    Cooling
    Corsair Hydro H115i
    Keyboard
    Logitech wireless K800
    Mouse
    Logitech MX Master 3
    Internet Speed
    1 Gbps Download and 35 Mbps Upload
    Browser
    Google Chrome
    Antivirus
    Microsoft Defender and Malwarebytes Premium
    Other Info
    Logitech Z625 speaker system,
    Logitech BRIO 4K Pro webcam,
    HP Color LaserJet Pro MFP M477fdn,
    APC SMART-UPS RT 1000 XL - SURT1000XLI,
    Galaxy S23 Plus phone
  • Operating System
    Windows 11 Pro
    Computer type
    Laptop
    Manufacturer/Model
    HP Spectre x360 2in1 14-eu0098nr (2024)
    CPU
    Intel Core Ultra 7 155H 4.8 GHz
    Memory
    16 GB LPDDR5x-7467 MHz
    Graphics card(s)
    Integrated Intel Arc
    Sound Card
    Poly Studio
    Monitor(s) Displays
    14" 2.8K OLED multitouch
    Screen Resolution
    2880 x 1800
    Hard Drives
    2 TB PCIe NVMe M.2 SSD
    Internet Speed
    Intel Wi-Fi 7 BE200 (2x2) and Bluetooth 5.4
    Browser
    Chrome and Edge
    Antivirus
    Windows Defender and Malwarebytes Premium
That link [%SystemRoot%\System32\NOTEPAD.EXE %1], at least on my edition of Windows 11 (22H2, 22621.2361) takes me to the older version of Notepad which provides the message: "A new version of Notepad is available." with a Launch button next to it.
 

My Computer

System One

  • OS
    Windows 11 Home

Latest Support Threads

Back
Top Bottom