11-12-2021 07:46 AM
Hi everyone,
I'm using "system" command to execute cmd.exe and a command bach.
i want to hide the cmd window when it's running.
is there any parametres to add to hide the cmd window using "system"?
thanks in advance.
11-14-2021 07:24 AM
Use LauchExecutableEx() instead.
11-18-2021 08:03 AM - edited 11-18-2021 08:08 AM
Thnks @rolfk for the reply
But i want to use system command for two reasons :
-/ to avoid usig bat file, i want the command written directly in the code
-/ i want that to wait for the program to exit
Is there any solution to make the cmd run in hidden mode?
11-18-2021 09:03 AM
LaunchExecutableEx + ExecutableHasTerminated can be a solution for your second issue.
Regarding the first one, you started the discussion with "execute cmd.exe and a command batch", now you don't want to use a .bat file... can you explain exactly what you are trying to do?
11-18-2021 09:45 AM
@Brainiac91 wrote:
Thnks @rolfk for the reply
But i want to use system command for two reasons :
-/ to avoid usig bat file, i want the command written directly in the code
Then prepend your commands with "cmd.exe". That is the command line application that implements the DOS compatible shell.
-/ i want that to wait for the program to exit
Have you read the documentation for LaunchExecutableEx() documentation? It states explicitly that you can check on the status of the launched executable by calling ExecutableHasTerminated() on the handle that is returned (and that you always have to close the handle by calling RetireExecutableHandle() after you are done with it).
Is there any solution to make the cmd run in hidden mode?
Again read the documentation. The second parameter to LaunchExecutableEx() is a windowState which accepts one of the documented values. Quite likely the LE_HIDE might just do what you are talking about, but the naming could be of course just coincidence. 😁