i'm having process id from Task manager, i need to get the process name (complete with extension) from it. is it possible? i checked other questions, they are mostly command based.
Asked
Active
Viewed 220 times
0
-
If they are command based, why don't you run .cmd from a C module? https://stackoverflow.com/questions/19209141/how-do-i-execute-a-shell-built-in-command-with-a-c-function – Confidenc3 Jul 14 '20 at 10:37
-
are you using Windows7 Task manager? – AziMez Jul 14 '20 at 10:43
-
Windows 10, does this makes any difference. – Kittu Jul 15 '20 at 13:30
1 Answers
1
Do you mean 'get the .exe filename by process ID' from C code?
If so, you may have interesting in OpenProcess()
and following GetModuleFileNameEx()
.
Don't forget to CloseHandle()
after you get the exe filename. :)

grizzlybears
- 492
- 2
- 9
-
thanks for the pointers, calling GetModuleBaseName() before CloseHandle(), seems answer for the query. – Kittu Jul 15 '20 at 13:29