Check if process is running and kill it

Vera

I am using perl version 5.8.4.

I am working with a program called JMP. Before opening the program I want to use perl to check if a process of the program is already running. If it is running, I want to close it.

Marcos Eusebi

REWORK: (Idk how I get here, I'm just lost)

This only works in windows cause is a shell execute (Taskkill).

system('taskkill /F /IM ImageName.exe >nul 2>&1');

Possible duplicate of:

How can I kill a program that might not exist from Perl on Win32?

perl > system documentation:

http://perldoc.perl.org/functions/system.html

Taskkill documentation:

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/taskkill.mspx?mfr=true

About syntax redirection ( Based in a awnser from How can I kill a program that might not exist from Perl on Win32? ):

http://ss64.com/nt/syntax-redirection.html

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

Check if a process is running on Bosun

分類Dev

How to kill a running process using ansible?

分類Dev

How to check the process is already running or not

分類Dev

Check if a process is running and if not, restart it using Cron

分類Dev

kill unresponsive process

分類Dev

Kill Local Process

分類Dev

Kill #### but process still there?

分類Dev

How to check how long a process has been running?

分類Dev

Proper and reliable way to check for a running process on AIX 7.1.0 in KornShell

分類Dev

Capturing kill code of go process?

分類Dev

How to kill a process on a port on ubuntu

分類Dev

Kill system process in Thread ruby

分類Dev

Kill child process created with fork

分類Dev

How to kill process of another user?

分類Dev

How to kill a daemon process in linux?

分類Dev

Unable to kill processes running concurrently

分類Dev

Kill my process if the other process is killed

分類Dev

How to kill a child process started by process in java?

分類Dev

Trying to find and kill a process by PowerShell script

分類Dev

Cannot Kill a process that has a thread started

分類Dev

How to kill process if thread encounters exception?

分類Dev

Kill process spawned by ssh when ssh dies

分類Dev

Global hotkey to kill a process in Windows 7

分類Dev

Global hotkey to kill a process in Windows 7

分類Dev

Attach, Detach and Kill a process in Screen with a bash script

分類Dev

Cannot kill a process after waking it up

分類Dev

How to hide a running process ?

分類Dev

setting ulimit on a running process

分類Dev

python subprocess.Popen kill process with child process