Simply pass a agruement to your program when running from CMD, like "yourProg.exe foo".
Then use COMMAND$ in your code to check whether it was run from console window.
I appreciate the reply, but I don't want to have to pass a parameter.
In a Windows program written in C - one that uses the GUI subsystem, e.g., WinMain() instead of main(), one can call AttachConsole(ATTACH_PARENT_PROCESS), and if the function returns nonzero, the GUI program was started from a command prompt.
However, when I try this from QB64, it always returns 0, no matter how the program was started.