Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I have a script that runs in the Windows NT Task Scheduler and it shows a DOS window pop up each time it runs throughout the day.
How can I eliminate the DOS window that pops up while the script is running?
I want the script to run without anything appearing on my screen. Is that possible?
  • Comment on Eliminate pop up window when script executes

Replies are listed 'Best First'.
Re: Eliminate pop up window when script executes
by sweetblood (Prior) on Feb 10, 2006 at 18:54 UTC
    use wperl.exe instead of perl.exe

    HTH

    Sweetblood

Re: Eliminate pop up window when script executes
by mikeock (Hermit) on Feb 10, 2006 at 19:27 UTC
    BEGIN{require Win32::Console;Win32::Console::Free() if ($^O eq "MSWin32");}
      Thanks,
      Its actually Windows 2000. Do I need to modify anything for it to work with Windows 2000?
        According to the cookbook no. I have used this on WinXP and Win 2000 with no problems. I added this to a script so I could use as scheduled task. Works great and I have not seen any popups when it runs! Hope this helps!
Re: Eliminate pop up window when script executes
by johnnywang (Priest) on Feb 11, 2006 at 02:08 UTC
    It seems sweetblood's answer did not get noticed, "wperl" is what you need, it's in the standard ActiveState distribution, in the bin directory.
Re: Eliminate pop up window when script executes
by vladb (Vicar) on Feb 10, 2006 at 18:45 UTC
    There's a way to use windows scheduler to execute your scripts similar to how one would do it via CRON on a UNIX system.

    There's more info at ActiveState aspn site

    Example from the site:
    at 23:37 /interactive /every:M,T,W,Th,F,S,Su cmd /c "c:\perl\bin\perl.exe c:\test.pl"
    


    _____________________
    "We've all heard that a million monkeys banging on a million typewriters will eventually reproduce
    the entire works of Shakespeare. Now, thanks to the Internet, we know this is not true."

    Robert Wilensky, University of California

Re: Eliminate pop up window when script executes
by duff (Parson) on Feb 10, 2006 at 21:21 UTC

    Look at Win32::Job. It has options to spawn a process in a minimized, maximized or hidden (the one you want) window.

      That doesn't help. He would still have to start a perl script to use Win32::Job, which would display a console before he got chance to spawn a process.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.