Re: [問題] 如何關閉使用system開啟的程式?

看板Perl作者 ( )時間17年前 (2008/01/19 15:41), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串3/4 (看更多)
根據熱心版大及版友的協助, 我上網東抄西抄生出了下面的程式, 這支程式會開啟IE,顯示指定的頁面, 並且在30秒後關閉開啟的process。 #!/usr/bin/perl my $ProcessObj; my $url = "http://tw.yahoo.com/"; use Win32::Process qw(STILL_ACTIVE); use Win32; Win32::Process::Create($ProcessObj, "C:\\Progra~1\\Intern~1\\iexplore.exe", "iexplore $url", 0, NORMAL_PRIORITY_CLASS, ".")|| die ErrorReport(); $ProcessObj->Wait(30000); $ProcessObj->GetExitCode( $exitcode ); print "Process completed with exit code $exitcode\n"; $ProcessObj->Kill($exitcode); -- ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ 國 立 聯 合 大 學 (理工/電資/管理/技術/客家)院所 招生中 National United University ─────────────────────────────────── 首頁 http://www.nuu.edu.tw BBS telnet://uun.twbbs.org -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.133.145.202 ※ 編輯: mosquito520 來自: 220.133.145.202 (01/19 15:42) ※ 編輯: mosquito520 來自: 220.133.145.202 (01/19 15:45)
文章代碼(AID): #17aQcJKs (Perl)
文章代碼(AID): #17aQcJKs (Perl)