Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If this is about the process remaining around in "server mode" after automation, you can just call the <code>quit</code> method on the application object. I edited by answer at <a href="https://stackoverflow.com/questions/3751403/how-can-i-run-a-macro-in-an-excel-file-i-open-with-perl/3751790#answer-3751790">How can I run a macro in an Excel file I open with Perl?</a> to include that. (You know, I thought if I told you that it was an <code>Application</code> object, you could read the <a href="http://msdn.microsoft.com/en-us/library/aa213696%28office.11%29.aspx" rel="nofollow noreferrer">MS documentation on that object</a> to figure out what you wanted to do. )</p> <hr> <p>However, you can kill a process in windows with <code>taskkill.exe</code>. You can read up by typing <code>taskkill /?</code> on the command line. It will handle <code>taskkill /IM excel.exe</code>. </p> <p>But if you want a specific PID, you need to use <code>tasklist.exe</code>. (Type <code>tasklist</code> at the command prompt to see the output. Or <code>tasklist /?</code> for more information.) </p> <p>The code below uses both: </p> <pre><code>use strict; use warnings; use English qw&lt;$OS_ERROR&gt;; use File::Spec; my $sys32dir = File::Spec-&gt;catfile( $ENV{SYSTEMROOT}, 'System32' ); my $tasklist_exe = File::Spec-&gt;catfile( $sys32dir, 'tasklist.exe' ); my ( $excel_line ) = grep { /^excel.exe\b/i } `$tasklist_exe`; # $excel_line: 'EXCEL.EXE 4468 Console 1 20,968 K # The PID is the second column my ( undef, $pid ) = split qr{\s+}, $excel_line; if ( my $rc = system( File::Spec-&gt;catfile( $sys32dir, 'taskkill.exe' ) , '/PID', $pid )) { die ( $OS_ERROR + 0 ) . ' - ' . $OS_ERROR; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload