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.
Asked
Active
Viewed 1,880 times
0
-
[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 Answers
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