Steve Loughran wrote:
Is there a way to run a system command, either via a system() call, or a
open(FH,"cmd |") (or any other way), and read in the output of that
command, without a cmd.exe instance appearing on the screen?
From what I understand if the command is marked as a 'console' app
(this is some flag in the executable header), it will always be given a
console window when it starts. I can immediately think of 2 avenues
that you can try:
(1) Use the Win32 API ShellExecute() function, and pass it flags that
result in the console being hidden or minimised:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/shellexecute.asp
Some thing like (untried):
Win32::GUI::ShellExecute(0,"","C:\\some\\path\\somecmd.exe","-options","C:\\working\\directory",SW_HIDE);
(2) Create a modified version of your command with the 'console app' bit
changed - see Win32::Exe module for one way to do this (also untried)
Regards,
Rob.