11/05/2026
CREATE_NO_WINDOW Set, Console Window Still Pops Up
Short answer: CREATE_NO_WINDOW only applies to the one process-creation call you pass it to. When a console window still flashes, it almost always belongs to a different launch: a scheduled task starting powershell.exe or python.exe directly, a virtual environment's python.exe started with DETACHED_PROCESS, a wrapper that drops the flag, or, on Windows 11, the default-terminal setting handing a console launch to Windows Terminal. Find the launch that owns the window, then stop that one from being a console launch at all.
What each flag actually does
Microsoft's process creation flags reference defines CREATE_NO_WINDOW as running a console application "without a console window", and says the flag is ignored when combined with CREATE_NEW_CONSOLE or DETACHED_PROCESS. Python's subprocess documentation exposes the same constants for creationflags (added in Python 3.7), and Node.js's child_process documentation has windowsHide, which defaults to false.
We tested each launch on Windows 10 22H2 with Python 3.12.3 and Node v24.15.0. The parent was always pythonw.exe (or a detached node.exe), so it had no console to lend, which is the situation a background service or scheduled job is in. The child asked Windows for its own console window and whether that window was visible.
| Launch | Console window in the child | Visible | What the child's own console programs get |
|---|---|---|---|
creationflags=CREATE_NO_WINDOW |
none | no | none: cmd.exe /c python ... under it also had no window |
creationflags=DETACHED_PROCESS, real python.exe |
none | no | a brand new console of their own |
creationflags=DETACHED_PROCESS, a venv's python.exe |
yes | yes | (this is the popup) |
shell=True |
yes | no | the same hidden console |
Node spawnSync / execSync with windowsHide: true |
none | no | not tested |
pythonw.exe, no flags |
none | no | a new console if they are console programs |
WScript.Shell.Run cmd, 0 |
yes | no | the same hidden console |
The shell=True row is hidden rather than absent because Python sets STARTF_USESHOWWINDOW with SW_HIDE for cmd.exe, which the same subprocess page documents. Hidden and absent behave the same until something else decides whether to show the window.
The test, so you can run it on your machine
The child reports what it got, using GetConsoleWindow, which returns NULL when the process has no console:
# child.py
import ctypes, sys
k = ctypes.windll.kernel32; u = ctypes.windll.user32
k.GetConsoleWindow.restype = ctypes.c_void_p
h = k.GetConsoleWindow()
vis = bool(u.IsWindowVisible(ctypes.c_void_p(h))) if h else False
with open(sys.argv[1], "a") as f:
f.write(f"{sys.argv[2]}: console_hwnd={'yes' if h else 'none'} visible={vis}\n")
The parent runs it three ways:
# launch.py -- run with pythonw.exe so this parent has no console to lend.
import os, subprocess, sys
here = os.path.dirname(os.path.abspath(__file__))
log = os.path.join(here, "result.txt")
py = os.path.join(sys.base_prefix, "python.exe") # the real interpreter, not a venv redirector
child = os.path.join(here, "child.py")
subprocess.run([py, child, log, "CREATE_NO_WINDOW"], creationflags=subprocess.CREATE_NO_WINDOW)
subprocess.run([py, child, log, "DETACHED_PROCESS"], creationflags=subprocess.DETACHED_PROCESS)
subprocess.run(["cmd.exe", "/c", py, child, log, "grandchild via cmd.exe"], creationflags=subprocess.CREATE_NO_WINDOW)
Run pythonw.exe launch.py. On our machine all three lines in result.txt read console_hwnd=none visible=False. Swap sys.base_prefix for a virtual environment's Scripts\python.exe and the DETACHED_PROCESS line flips to visible=True, with a real window on screen.
Five launches that ignore the flag you set
A scheduled task that starts a console program
Windows Task Scheduler starts the task's action itself, so no flag in your code is part of that call. powershell.exe -WindowStyle Hidden is the usual attempt, and Microsoft's powershell.exe reference only says it "sets the window style for the session". PowerShell has to be running to read that argument, so the console it was given already exists.
This is the one that caught us. Aaron's inbox routine ran as a scheduled task every 15 minutes, calling powershell.exe -NoProfile -WindowStyle Hidden, with Python as a plain child inheriting that console. On his Windows 11 machine it flashed a visible window on that cadence for two days before anyone noticed the pattern. The fix, on 08/29/2026, was to point the task at a small VBScript wrapper instead (below).
A venv's python.exe with DETACHED_PROCESS
Python's venv documentation notes that since 3.7.2, Windows uses "redirector scripts" for python[w].exe instead of copying the real binaries. The redirector then starts the real interpreter as its own child. Give the redirector DETACHED_PROCESS and it has no console, so the real interpreter, a console program with a console-less parent, gets a new visible one. That is the visible row in the table. CREATE_NO_WINDOW does not have this problem: the real interpreter inherits the redirector's invisible console.
A grandchild, or a wrapper that drops the flag
DETACHED_PROCESS does not hide anything for the next generation. Microsoft's console creation page says a process created with it is not attached to a console, so every console program it starts gets its own. A wrapper function is the other way the flag goes missing: we found ssh and node launches in one of Aaron's apps going through a renamed helper that never passed the flag, and the existing test missed them because it did not look through the wrapper.
Windows Terminal as the default terminal
Windows 11 22H2 made Windows Terminal the default for every command-line app, set under Settings > Privacy & security > For developers (Microsoft's announcement, 10/18/2022). Microsoft's install page says the setting also reaches Windows 10 22H2 after update KB5026435.
On Aaron's Windows 11 machine, the diagnosis of the 15-minute window was this delegation: Windows Terminal did not reliably honor -WindowStyle Hidden or CREATE_NO_WINDOW, both of which predate it. Switching the default back to Windows Console Host did not fully stop it. We could not reproduce this on the Windows 10 test machine, which has no Windows Terminal installed, so check that setting first on any Windows 11 machine.
Node without windowsHide
Node.js leaves windowsHide off by default for spawn, exec and their sync forms. Set it on every call from a background process. In our test, with it on, the Python child got no console window at all, the same result as CREATE_NO_WINDOW.
Find the launch that owns the window
Polling for windows misses them. In a later hunt for flashing git.exe windows on 10/18/2026, a watcher that checked every 10 ms missed a real popup, and was replaced by one that Windows notifies the moment a console window is shown (Windows' SetWinEventHook API is the event route). That hunt cleared three apps and found the wrapper gap above, though not the source of every popup. What it got right:
- Log every launch of the suspect program together with its parent process, so the window has an owner.
- Prove the watcher with a control: start the program once without the hide flag and confirm it is caught.
- Do not count
conhost.exelaunches as popups.CREATE_NO_WINDOWstill creates a console, just without a window, so a console host appearing proves nothing.
Fixes for a job that runs in the background
| Fix | Window | Catch |
|---|---|---|
| Move the job into an app that is already running | none: nothing is launched | Runs only while the app is up |
Task action is pythonw.exe |
none: a GUI program, never given a console | sys.stdout can be None; log to a file |
Task action is wscript.exe running a VBScript wrapper |
hidden | One more file to keep |
Every subprocess call passes CREATE_NO_WINDOW |
none | Each call site has to remember it |
The first is the one we moved to. The inbox routine's scheduled task vanished after 08/29/2026 and nothing reported it was gone, so on 09/25/2026 the job moved inside Aaron's dashboard app, which runs it every 15 minutes while the app is open. A job inside a running app has no console launch to hide.
If it has to stay a scheduled task, pythonw.exe is the simplest action. Python's sys documentation warns that stdout and stderr can be None for apps started with pythonw, so write to a log file rather than printing. For a task that must run a console program, the wrapper uses window style 0, which Microsoft's WshShell.Run reference documents as "Hides the window":
Set sh = CreateObject("WScript.Shell")
sh.Run """C:\path\to\python.exe"" ""C:\path\to\job.py""", 0, False
On our test machine, the child reported a console that existed and was not visible. On Aaron's Windows 11 machine, this wrapper is what stopped the 15-minute window.
More Windows command-line fixes are in the Windows articles, including why cd does not change drives in cmd and setting up a Dev Drive for repositories and caches.
FAQ
Why does CREATE_NO_WINDOW not work with DETACHED_PROCESS?
Microsoft's reference says CREATE_NO_WINDOW is ignored when used with DETACHED_PROCESS or CREATE_NEW_CONSOLE. Pick CREATE_NO_WINDOW alone for a console program you want hidden.
Does pythonw.exe need CREATE_NO_WINDOW?
No. pythonw.exe is a GUI-subsystem program and is never given a console. Console programs it starts still need the flag.

Let my Claude help your Claude
If you want a second pair of eyes on how your own setup uses AI-assisted development, that's what this is: me, personally, for AI specifically. Broader business growth and technology consulting is Brandager's own team.
Researched and drafted with AI, then reviewed and edited by the site's editors.