Visual-studio – Adding editors in Visual Studio “Open With…” dialog box


I added a batch (.bat) file to my project. I want to add a new editor for batch files that would actually execute this batch file in command prompt window.

What I did, but didn't remember my editor:

  1. Right clicked on my .bat file
  2. Selected Open with…
  3. Clicked Add
  4. Set program as "cmd /c" and some Friendly name
  5. Accepted this dialog.
  6. A new window appears that tells me it can't validate editor path (because of the additinoal parameter, because if I remove it, it works)
  7. My new editor is in the window.

When I open the same Open with… dialog again, my editor isn't present.

How should I tackle this?

Best Solution

Ok. I managed to solve this myself.
As I found on the internet this is a Visual Studio bug, so it doesn't remember these kind of editors (parametrised executable file names). But nonetheless. The solution goes like this:

  1. Create a separate batch file i.e. ExecuteBatch.cmd
  2. Put this code in it:

    @cmd /c %1

  3. Then add the new editor in Visual Studio by pointing to this ExecuteBatch.cmd file.

Voila. Problem solved. Detailed instructions can be found in this blog post.