[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 API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,488 questions
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
8,693 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jeanine Zhang-MSFT 9,351 Reputation points Microsoft Vendor
    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