Share via


why is conhost.exe is running after executed a consoleApplication

Question

Tuesday, January 3, 2017 11:26 PM

hello everybody.

i have made a very simple console Application with visual studio 2015 and c++ console program.

#include "stdafx.h"

int main()
{
 getchar();
    return 0;
}

i have looked at the task manager, conhost.exe program will be showed after executed the console program.

i don't know not executed conhost.exe.

because i am writing a some code, the main process will be called a child console program using CreateProcess.

A number of child Console program will be between 10~200. so i don't want to execute the conhost.exe with my child process.

All replies (3)

Wednesday, January 4, 2017 1:43 AM

Hi 라이트돌,

thanks for posting here.

>>why is conhost.exe is running after executed a consoleApplication

The conhost.exe process fixes a fundamental problem in the way previous versions of Windows handled console windows, which broke drag & drop in Vista. It’s a completely legitimate executable—as long as it’s running from the system32 folder, and is signed by Microsoft. Scanning your computer for viruses is never a bad idea, though.

Here is a document about What Is conhost.exe and Why Is It Running.

http://www.howtogeek.com/howto/4996/what-is-conhost.exe-and-why-is-it-running/

Hope this could be help of you.

Best Regards,
Sera Yu

Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.

MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


Wednesday, January 4, 2017 5:38 AM

Thanks for reply.

I have a program made by visual studio 6.0.the program do same things, execute child process by parent process in windows 10 OS,a child process is console application, but not lunched the conhost.exe from the child process.

because we should exchange the data between process by namedpipe with iocp, i saw the conhost.exe at task manager.the conhost.exe cpu usage will be increased.


Wednesday, January 4, 2017 12:47 PM | 1 vote

If your child console applications do not do any console i/o then specify DETACHED_PROCESS in the call to CreateProcess that starts the child console application.

The child process will run without a console window and no conhost.exe process will be created for it by the system.

Alternatively, you can avoid consoles/conhost.exe for child applications by creating them as Windows applications (i.e., WinMain instead of main as the entry point) that do not create any windows.