0

Just wanted to know how to get default Windows text editor .exe path c++. I badly need this to improve one of my c++ assignment. I've no idea how to do it.

Krishanu Dey
  • 6,326
  • 7
  • 51
  • 69
  • [It's unlikely that you really should have to do this, what's your actual problem?](http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem) – Kos Aug 06 '12 at 13:49
  • If you just want to open a .txt file (or any file) with its default program on Windows, you can just use the `system` function and pass the path to the file as the only argument. – Kos Aug 06 '12 at 13:51
  • I just want to get the default program path of a specific file type. In this instance I'm dealing with .txt file types. – Krishanu Dey Aug 06 '12 at 13:52

2 Answers2

4

If you require it to open files, then you can use ShellExecute with the edit (or open) verb to get everything done all-in-one, else you can use SHAssocEnumHandlers to get the handlers for the text based files you are interested in.

In the most simple case, you can also use %windir%\\notepad.exe which will link to notepad on any desktop version of windows.

Necrolis
  • 25,836
  • 3
  • 63
  • 101
1

The usual way would be with FindExecutable.

Jerry Coffin
  • 476,176
  • 80
  • 629
  • 1,111