When I get a program that is expose to open with cmd it will come up then disappear before I have a change to do anything.

Dani AI

Generated

A console window that opens briefly and then disappears usually means the program ran and immediately exited (either finished or crashed). Both and pointed toward running the program from a shell so the session stays visible; the replies are on the right track. Below are additional, durable ways to capture output and diagnose what actually happened without repeating the exact commands already posted.

A small batch wrapper keeps the window open and makes any messages readable:

@echo off
"C:\full\path\to\program.exe" arg1 arg2
pause

The final pause forces a keypress before the window closes. For silent failures or long output, redirect stdout and stderr to a file for later inspection:

"C:\full\path\to\program.exe" > "%USERPROFILE%\Desktop\program-output.txt" 2>&1

Troubleshooting notes: if the executable is a 16‑bit DOS program, it will not run on 64‑bit Windows — use a VM or DOSBox. If there is no visible output even when wrapped, run the binary under a debugger or use logging tools (Procmon/ProcDump on older systems) to see crashes or missing DLLs. Also confirm the wrapper is saved with a .bat extension and that the full path is used when necessary. Later posts show accepted a switch-based approach from as the fix; the batch and redirection options above provide alternative ways to capture errors for diagnosis.

Recommended Answers

All 5 Replies

Ummm, what?

If you haven't been doing it this way, try it now...

Go to the start menu, click on run. Type CMD and then enter.
That will bring up the window. Then type whatever the name of the program is in that window. It will stay open.

Never I gave up just delete this thread I feel like killing myself

If you want to keep a program open (and you are running it from)

cmd /k {DOSPROGRAMHERE}

Zachery you rock thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.