in reply to Re^6: Suppress windows cmd for system command in Perl
in thread Suppress windows cmd for system command in Perl

its a windows application.

I suspect that that the window you are seeing is being created when the C++ app spawns Perl; rather than when Perl calls system; and unless you have access to the sources of the C++ and can modify it; you may be stuck.

The only suggestion I have that might fix it without modifying the C++ app is to swap your call to system, for a call to Win32::Process, and try using the CREATE_NO_WINDOW flag.

If that doesn't work, see above.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
I'm with torvalds on this Agile (and TDD) debunked I told'em LLVM was the way to go. But did they listen!
  • Comment on Re^7: Suppress windows cmd for system command in Perl

Replies are listed 'Best First'.
Re^8: Suppress windows cmd for system command in Perl
by marinersk (Priest) on Jun 18, 2015 at 20:39 UTC

    I agree; likely it is the launch from C++which is creating the window, and thus would not expect the fix to be in the Perlportion of the code.

    I did find this -- if not directly applicable, it may be a cluebat towards a solution. Stringing several of the answers together seems to yield a workable solution:

          Use CreateProcess

Re^8: Suppress windows cmd for system command in Perl
by Chaks (Initiate) on Jun 18, 2015 at 19:59 UTC
    Though I have not tried Win32::Process as I have some limitation to add new module in my application. But as you suspected the application is not creating the window as I am able to see the command that I gave in system in perl getting executed in command prompt window. I am able to rectify this in Linux by adding a extra argument $args5 = " 2>&1 >/dev/null"; which is passing the output to /dev/null and do not show on prompt. Similar way I want it in Windows so that it do not show command prompt and complete the command execution in background.
      Hello, start /B program > NUL 2>&1 is the windows equivalence of the shell syntax you refer. Anyway if you see the command executed in the prompt you can also add some line to show up who called it like in Re: Who called Perl? (solved) (if is relevant)
      L*
      There are no rules, there are no thumbs..
      Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

      Try invoking the java program directly from the C++ program.

      If you still get the pop-up; it means it is out of the control of Perl.

      If you don't; you have a way to prevent the problem.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
      I'm with torvalds on this Agile (and TDD) debunked I told'em LLVM was the way to go. But did they listen!
        As per the design of my application I cannot invoke the java command from C++ program it has to be in Perl script itself.