6

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.

2

3 Answers 3

5

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".

3
  • 2
    The Shift method does not work for me Commented Jan 11, 2016 at 21:32
  • Same here with regards to Shift always bringing up Open With, this turned out to be incorrect for me. Commented Dec 21, 2016 at 3:53
  • If Shift + right click doesn't work, Shift + F10 may work.
    – imoatama
    Commented Dec 23, 2016 at 2:56
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.

1

As for adding an "open with" for .bat files, that can be done. (It does not appear for .bat files, which seems an intentional "feature" in Windows.) While the other two answers show adding support for an "Edit" command (which was also requested), here is a reg command to add "open with". Note how there's also a specific code value to be used for the key:

reg.exe add "HKCR\batfile\Shell\Open With\Command" /ve /t REG_SZ /d {09799AFB-AD67-11d1-ABCD-00C04FC30936}

This should be run at a command prompt which has been opened to run "as administrator". Note also the use of a quote around the keyname, to implement the space between open and with.

As soon as this is executed successfully, you should find the open with appearing when right-clicking a bat file (without any need of a restart, or even re-opening Windows Explorer.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .