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 |