LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-04-2005, 02:16 AM   #1
mnguyen
LQ Newbie
 
Registered: Feb 2004
Location: Singapore
Posts: 13

Rep: Reputation: 0
Kill windows process in Perl


Hi

I am working on Perl. I want to kill a process given its name "notepad.exe", for instance.
I know that there is a function called kill to do this job,but its argument is processID rather than the process name.

Can you guys give me some clues about what module and what function that I should use ?

Tks a lot.
 
Old 01-04-2005, 09:22 PM   #2
Chrax
Member
 
Registered: Apr 2004
Distribution: Dapper
Posts: 167

Rep: Reputation: 31
Killing a process by name would potentially be terribly inaccurate, and PID is the only good way to do it. However, if your script spawned the process, I believe you can find the PID when you create it.

If I find something I'll get back to you.
 
Old 01-04-2005, 09:35 PM   #3
Chrax
Member
 
Registered: Apr 2004
Distribution: Dapper
Posts: 167

Rep: Reputation: 31
Ok, syscalls don't have any readily apparent ways of find PIDs.

Does Windows have a lsof (list open files) equivalent? If so, you can play around with that for a bit and have a perl regex to get the PID for you.

Sorry I couldn't be more helpful.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot kill process essdeeay Linux - General 2 11-10-2005 01:38 PM
cannot kill process (kill -9 does not work) mazer13a Linux - General 1 05-27-2005 02:32 PM
how to kill a process in C++? mimithebrain Programming 9 06-17-2004 05:20 PM
kill a process for sure spuzzzzzzz Linux - General 1 06-05-2004 04:59 PM
Why can't I kill this process? solking Linux - General 5 10-29-2003 11:24 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration