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

In Linux
system('perl abc.pl &')
launches abc.pl and instantly returns to the program so it can continue.
abc.pl then processes independently.
 
Is there a way to do this in Windows?  
Thanks for your help!

Replies are listed 'Best First'.
Re: system() - launch a program and return without waiting in Windows
by BrowserUk (Patriarch) on Dec 14, 2006 at 16:21 UTC

    system(1, 'perl abc.pl')

    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.

      I don't see that in the docs for system() anywhere. Why does that work? In fact, it doesn't seem to work at all in cygwin or linux... It does work in active perl apparently, though I still don't see it in the docs even for active perl.

      I was about to suggest system(@cmd) unless fork.

      -Paul

        See system() not quite as described? for previous discussion.


        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.
Re: system() - launch a program and return without waiting in Windows
by geekphilosopher (Friar) on Dec 14, 2006 at 18:00 UTC

    BrowserUK has answered your question, but I'll mention an alternative idea. It's pretty inefficient to shell out and then re-exec perl. Maybe it's possible to make abc.pl a module, then fork your process and call that module from perl?

      Or use Win32::Process

Re: system() - launch a program and return without waiting in Windows (was: system('start command');)
by mr_mischief (Monsignor) on Dec 14, 2006 at 22:37 UTC
    Besides the other excellent advice provided above, you may want to look into the 'start' command for Windows, starting perhaps with:
    start /?
    at a command line.


    Christopher E. Stith