[BUG] FreeConsole does not close Terminal on Windows 11

Justin Taylor 20 Reputation points
2023-05-08T20:44:56.2033333+00:00

The docs describe that the FreeConsole() command should detach a process from it's parent console, and then that console will auto-close if it has no other child processes.

This works correctly on Windows 10, but on Windows 11 the console remains open after running FreeConsole(). Only workaround is to find the console by PID and then force close it afterwards.

I believe this is a bug with Terminal possible since Terminal is now the default console app in Windows 11.

Windows development | Windows API - Win32
Windows for business | Windows Client for IT Pros | User experience | Other
0 comments No comments
{count} votes

Accepted answer
  1. Jeanine Zhang-MSFT 11,356 Reputation points Microsoft External Staff
    2023-05-09T01:52:23.6133333+00:00

    Hello,

    Welcome to Microsoft Q&A!

    You could refer to the links:

    Terminal window/tab is not closed when console application calls FreeConsole

    Add support for start /B and FreeConsole

    This issue was addressed. I suggest you could try to use Windows Terminal Preview v1.17.1023 . Download from Microsoft Store

    Thank you.

    Jeanine


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.