0

So, to be more specific, I want to make a C++ program (Windows) that can execute a command without anything being displayed to the user.

No CMD window, No Command Output.

I would show my previous attempts, but it's not really anything useful, I just used the system() function to execute a command. I need to do the same, but without a popup window.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
  • 1
    I typed up an answer below. But it really comes down to this: **what are you really trying to do?** – selbie Aug 29 '21 at 08:14

1 Answers1

2

system() uses CreateProcess() to run cmd.exe /C <command>. You have no control over the console window that may be created.

Use CreateProcess() directly instead, so you can specify the CREATE_NO_WINDOW flag, and/or set its input STARTUPINFO::wShowWindow field to SW_HIDE.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770