in reply to Opening files for other exes in Windows

Neither of the two other solutions are what I'd use on Windows to start a detached process. The ampersand-method doesn't work on Windows, because the interpretation of the ampersand is shell-dependent. I stay away from fork() because it brings many problems with it whenever shared resources are released.

On Windows, you have three methods of launching a process detached from the main program. The easy way is to use the start command of cmd.exe, see help start for more information:

system( "start $File");

to launch $File detached from your program.

If you want to go to the bare metal, there is the CreateProcess function which you can access via Win32::API to create a process.

If you want to stay close to Perl, you can use

system( 1, $File );

which is a bit underdocumented and does weird things to your console window, but otherwise also spawns an independent process.

Replies are listed 'Best First'.
Re^2: Opening files for other exes in Windows
by ecuguru (Monk) on Aug 23, 2006 at 07:57 UTC
    Forking did indeed fail, and the & didn't work in Windows But both sets of advice were good knowledge for me.

    I'm doing really well with (1,$file)
    Is there a performance difference in calling a file with system($file); and system("start $file");?
    Gotta keep at it, but it's a lot closer now. Many thanks!