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

Dear all, I would like to do the following : system(notepad test.txt); print "This is a test\n"; Now to get the line "This is a test" I need to close my notepad first. Is their a way that the script opens the notepad but keep running the script without that I have to close notepad first. Thanks, Pieter
  • Comment on How to continue a script after using a system call without the system call has been closed

Replies are listed 'Best First'.
Re: How to continue a script after using a system call without the system call has been closed
by $code or die (Deacon) on Mar 07, 2001 at 05:19 UTC
    use Win32::Process - It's standard with ActiveState Perl. e.g....

    use Win32::Process; my $Notepad; Win32::Process::Create($Notepad,"D:\\winnt\\system32\\notepad.exe","no +tepad test.txt",0,CREATE_NEW_CONSOLE,".")|| die ErrorReport();

    $code or die
    $ perldoc perldoc
Re: How to continue a script after using a system call without the system call has been closed
by vladdrak (Monk) on Mar 07, 2001 at 10:21 UTC
    you can also do either:
    system("start notepad test.txt");
    or
    `notepad test.txt`;

      I've found that using Win32::Process is better as calling start requires a DOS window to be open

      $japh->{'Caillte'} = $me;