I just started my Windows 11 laptop and noticed several .cmd command windows briefly appeared and disappeared. Is there a way to keep them open the next time this happens so I can read the commands or error messages and figure out what launched them?
3 Answers
Check Settings > Apps > Startup first. You can also open Task Manager and review the Startup apps list for anything unfamiliar. If you recognize a program that launches those scripts, disable it temporarily and restart to see whether the windows stop appearing.
If it happens again and you need to inspect a specific script, running the command manually from an already-open Command Prompt can keep the output visible. You can also add `pause` at the end of a script you own, but don’t edit unknown system scripts just to stop the window from closing.
Start with Task Scheduler’s task history and Event Viewer around the exact time it happened. Also check Startup apps, since those are usually easier to review than digging through every log.
The safest approach is to identify what is launching the scripts rather than forcing every command window to stay open. Look in Task Scheduler for recently run tasks, and check Event Viewer under Windows Logs > System and Application for entries around the time it happened. The task or program name may point to an update, utility, or scheduled maintenance job.

Where should I start looking for the relevant logs? I’m not sure which Windows tools show what launched the command window.