I am happy to say that I currently avoid Windows, but your code gives me an idea or three:
exec(qw/wmic process call create/ => "CommandLine='$pathToMyself'" ); +# if Perl scripts are associated to perl exec(qw/wmic process call create/ => "CommandLine='perl $pathToMyself' +" ); # if perl.exe is in %PATH% exec(qw/wmic process call create/ => "CommandLine='wperl $pathToMyself +'" ); # if wperl.exe is in %PATH%
These of course are completely non-portable in typical Microsoft style, so if you want your script to be generally usable, try adding this before one of the above:
unless ($^O eq 'MSWin32') { exec( $pathToMyself ) }
Really the best answer is probably to get a better operating system...
In reply to Re^2: Restarting a Perl script on Windows 10
by jcb
in thread Restarting a Perl script on Windows 10
by petro4213
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |