GithubHelp home page GithubHelp logo

taskkill's Introduction

taskkill

Wrapper for the Windows taskkill command. Ends one or more tasks or processes.

Install

npm install taskkill

Usage

import {taskkill} from 'taskkill';

await taskkill([pid, pid2]);

API

See the taskkill docs for more.

taskkill(input, options?)

Kill asynchronously.

Returns a Promise.

taskkillSync(input, options?)

Kill synchronously.

Arguments

input

Type: string | number | string[] | number[]

One or more process IDs or image names, but not mixed.

options

The system, username, password options are mutually inclusive.

system

Type: string

Name or IP address of a remote computer (do not use backslashes). The default is the local computer.

username

Type: string

A user specified by User or Domain\User.

The default is the permissions of the current logged on user on the computer issuing the command.

password

Type: string

Password of the user account for the specified username.

filter

Type: string

Types of processes to include or exclude from termination.

See the taskkill docs for supported filters.

force

Type: boolean

Forcefully terminate processes. Ignored for remote processes as all remote processes are forcefully terminated.

tree

Type: boolean

Terminate all child processes along with the parent process, commonly known as a tree kill.

Related

  • tasklist - Wrapper for the Windows tasklist command
  • fkill - Force kill processes, cross-platform

taskkill's People

Contributors

alextes avatar ankology avatar brandon93s avatar kevva avatar richienb avatar sindresorhus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

taskkill's Issues

doesn't work in win10

I need to run an app as an administrator than only processes are killed otherwise not

Warning that termination is not guaranteed

I think it would be good if the Readme warned people about false positives.

Even if SUCCESS: Sent termination signal to the process "abc.exe" with PID 123 is returned, there is no guarantee that the process will actually be terminated (see example below) - it's just sending the signal, not more, not less.

λ tasklist /fi "imageName eq boinc.exe"                                     
                                                                            
Image Name                     PID Session Name        Session#    Mem Usage
========================= ======== ================ =========== ============
boinc.exe                    12312 Console                    1     14,108 K
                                                                            
λ taskkill /im "boinc.exe"                                                  
SUCCESS: Sent termination signal to the process "boinc.exe" with PID 12312. 
                                                                            
λ tasklist /fi "imageName eq boinc.exe"                                     
                                                                            
Image Name                     PID Session Name        Session#    Mem Usage
========================= ======== ================ =========== ============
boinc.exe                    12312 Console                    1     16,616 K
                                                                            
λ taskkill /im "boinc.exe" /f                                               
SUCCESS: The process "boinc.exe" with PID 12312 has been terminated.        
                                                                            
λ tasklist /fi "imageName eq boinc.exe"                                     
INFO: No tasks are running which match the specified criteria.              

Just to be clear: the warning should apply to the force option as well: for example, if you are trying to kill a task that depends on a service, you will have to kill the service first.

There are also the usual suspects, of course: insufficient permissions, unkillable system processes, faulty driver processes, etc. All in all, you should probably always check whether the process you tried to kill was actually killed.

PS: Just in case anyone wants to parse the taskkill output to report info, success, errors, etc. in a more user friendly way: please note that these messages are i18n'ed (for example, in English: SUCCESS: ..., in German: ERFOLGREICH: ...).

PPS: It might be worth investigating what the pros and cons of using taskkill compared to wmic or Stop-Process are. Perhaps there's a better way to kill stuff on Windows ... I only know for a fact that shutdown /t 0 /f /r is very reliable when it comes to killing processes. Unfortunately, however, it has terrible performance. :/

How to Use?

Hello,

I am new to this, I have a normal application in php but I need to use this application to kill client-side applications.

As I can add to my app?
I do not understand terms "$ npm install --save taskkill"

Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.