I've an C++ method (using Visual Studio, if it helps) that calls to cmd like this:
start \B example.exe arg1 arg2 arg3
The problem is that this call opens a (cmd) window. If i have another cmd opened, \B works, but if not, it opens a new window.
I also tried without start \B but it's the same....
I want to avoid this new window, but I don't know how. Any idea?
You can use the "/C" switch
this will run the "dir/b" command and exit-- no window will be shown, but if you want to set the ECHO off use the "/q" switch
Try ShellExecuteEx, setting nShow=SW_HIDE.
I dont know how to do it in C++ but to open a new command prompt window that is also minimized (or "hidden") using a batch file i would use:
Or if you start the command prompt you can type:
This restarts the current command prompt window with out closing it, however all previously set environment variables are reset. Hope this helps!
(PS. This was tested and was successful on Windows 7 Ultimate OS)
Just call it without start:
How about using WSH instead of a CMD Prompt?
You can use the .Run , 0 to hide the window like: