terminating processes on Windows using the taskkill command
Tested against Windows 10 / Python 3.10 / Anaconda
pip install taskkill
taskkill is a Python library that provides utility functions for terminating processes on Windows using the taskkill command. It allows users to easily kill processes by PID, terminate processes along with their child processes, and perform forceful termination if necessary. The library also includes a regex-based search function to find and terminate processes based on specific criteria such as window title, window text, class name, and process path.
Features
- Kill processes by PID
- Terminate processes along with their child processes
- Forcefully terminate processes
- Search and terminate processes using regex-based criteria
- Dry run option to preview processes without actually terminating them
from taskkill import taskkill_pid, taskkill_pid_children, taskkill_force_pid, taskkill_force_pid_children, taskkill_regex_rearch
# Kill processes by PID
results = taskkill_pid(pids=(1234, 5678))
# Terminate processes along with their child processes
results = taskkill_pid_children(pids=(1234, 5678))
# Forcefully terminate processes
results = taskkill_force_pid(pids=(1234, 5678))
# Forcefully terminate processes along with their child processes
results = taskkill_force_pid_children(pids=(1234, 5678))
# Search and terminate processes using regex-based criteria
results = taskkill_regex_rearch(
dryrun=False,
kill_children=True,
force_kill=True,
title=r"\bnotepad$",
windowtext=".*",
class_name=".*",
path="notepad.exe$",
)
# Dry run - Preview processes without terminating them
taskkill_regex_rearch(
dryrun=True,
kill_children=True,
force_kill=True,
title=r"\bnotepad$",
flags_title=re.I,
windowtext=".*",
flags_windowtext=re.I,
class_name=".*",
flags_class_name=re.I,
path="notepad.exe$",
flags_path=re.I,
)
Contribution Contributions are welcome! If you encounter any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request on the GitHub repository.
License This project is licensed under the MIT License.
Metadata
Release files for taskkill 0.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| taskkill-0.10.tar.gz | 5.4 kB | Without provenance | Details for taskkill-0.10.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| taskkill-0.10-py3-none-any.whl | Python 3 | none | any | Details for taskkill-0.10-py3-none-any.whl |
Total release size: 11.9 kB
Release files / taskkill-0.10.tar.gz
| Download URL | taskkill-0.10.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5586bf9b8f81d9aa0b52989e1afc0839728fe56d390276d20d98e34f5c0a14c7
|
|
BLAKE2b-256 checksum How to use checksums |
5ea69c6059c04669a1d27b74dea03aa06112e305020d5e58566f0344990b5c30
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.10
|
Release files / taskkill-0.10-py3-none-any.whl
| Download URL | taskkill-0.10-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
afe9a939004286f4a1554056d00c7284d37a6555c3b32df542e41472b0aa7bab
|
|
BLAKE2b-256 checksum How to use checksums |
2ecf4aaca9d7317184aaf323e7faa6de983b86d6692ca1538914ee87ffe6d500
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.10
|
Security for taskkill 0.10
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.