How do I add "edit" or "open with" to the context menu for .bat files in Windows Explorer in Windows 7?
Solution 1
You can get 'Open With' in the context menu for any file by simply holding the Shift key as you right click.
If Shift + right click doesn't work, Shift + F10 may work.
To get 'Edit' in the context menu you need to edit the registry. Open up regedit and browse to HKEY_CLASSES_ROOT\bat\shell
. Create a new key called Edit
, then create a new key under that called command
. Edit the default value of the command key to be "c:\windows\notepad.exe" "%1"
.
Solution 2
For me, open with does not appear even for shift. However, Editing the registry as specified in the other answer does work. With one modification:
C:\> reg.exe add HKEY_CLASSES_ROOT\batfile\Shell\Edit\Command /ve /t REG_EXPAND_SZ /d "xxx"
You need to use the above in cmd to create a key with default type expandable string.
Also, When I screwed up the open command, I had to fix it by deleting:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bat
and all sub keys.
Related videos on Youtube
Matthew Simoneau
Updated on September 17, 2022Comments
-
Matthew Simoneau over 1 year
I've tried this by mucking around with "Set Associations", but all I've accomplished there is messing up the default Open action. I've also found a bunch of registry scripts attached to random forum threads, but I'm too nervous to run them.
-
BillP3rd over 13 years
-
AJM about 2 yearsThe links in the above comment are out of date - try web.archive.org/web/20100731044415/http://msdn.microsoft.com/… and web.archive.org/web/20100731045651/http://msdn.microsoft.com/… instead.
-
-
felixfbecker over 8 yearsThe Shift method does not work for me
-
Hashim Aziz over 7 yearsSame here with regards to Shift always bringing up Open With, this turned out to be incorrect for me.
-
imoatama over 7 yearsIf Shift + right click doesn't work, Shift + F10 may work.