@Graf Zahl Yes, I tried. The main problem with this approach is that it returns control to the parent terminal (cmd, PowerShell, etc.) immediately after the process is started. This creates a situation when two applications control one console window simultaneously. This also means that when the process exits, you won't see the expected line with the current directory path and cursor, as it was already printed long before. Things become match more broken if you use Far Manager:
. @Quasar This has the same cons as described above, but also as it spawns an additional process, it will trigger a lot of antivirus false positives.
For now, I decided to make .exe and .com link a DLL with the main code, this cleared almost all false positives, but I can't guarantee that they won't come up again. And it's a very annoying work to try to bypass the stupid heuristic AI of antivirus. I don't want to do it ever again.
If your antivirus still detects viruses in Inter-Doom distributions, report it to your antivirus maintainers as false positive.
In my opinion the best solution to CLI problem is the initial one: Make only .exe, make it SUBSYSTEM:CONSOLE, immediately close automatically created console window if not needed. The only con is blinking of the icon of console window in the task bar (and blinking of the console window itself) that @Julia Nechaevskaya doesn't like. If you think that the blinking is ok, you can attempt to convince @Julia Nechaevskaya.