Why does windows console program run in new command prompt?

Dark Matter 1 Reputation point
2021-02-11T15:36:40.85+00:00

Recently, I was charged with maintaining a windows console application written in C++ in Visual Studio. I can run it from the console by just typing the program name, for eg. program_name.exe . However, when I run it in windows 10, it opens a new command prompt window and prints its output to that window. However, in other versions of windows, like windows server 2019 it does not open a new command prompt window but prints its output in the same command prompt window from where it was launched. I don't want it to open a new command prompt. I want it to give its output in the same command prompt where it was launched. How do I fix this issue in windows 10?
Additional info: This application is a .exe which also invokes a .dll library.

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,729 questions
{count} votes

1 answer

Sort by: Most helpful
  1. sanneraj 1 Reputation point
    2021-06-21T16:12:11.037+00:00

    Did you ever figure this out? I also have an .exe that I can run from the command prompt, but it opens in a separate window. I have to pass about 10 input files to the .exe in order for it to run. It's a major pain to type out all of those files, but running the .exe with a .bat file does not communicate to the new window that opens.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.