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

It is internally called by C++ application.

Does the C++ app have a GUI?


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^5: Suppress windows cmd for system command in Perl

Replies are listed 'Best First'.
Re^6: Suppress windows cmd for system command in Perl
by Chaks (Initiate) on Jun 18, 2015 at 19:18 UTC
    Yes its a windows application.
      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!

        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

        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.