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.
In reply to Re: Opening files for other exes in Windows
by Corion
in thread Opening files for other exes in Windows
by ecuguru
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |