terminating processes on Windows using the taskkill command
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file taskkill-0.10.tar.gz
.
File metadata
- Download URL: taskkill-0.10.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5586bf9b8f81d9aa0b52989e1afc0839728fe56d390276d20d98e34f5c0a14c7 |
|
MD5 | 8ad2e9baab5cde02819531bb1d62700c |
|
BLAKE2b-256 | 5ea69c6059c04669a1d27b74dea03aa06112e305020d5e58566f0344990b5c30 |
File details
Details for the file taskkill-0.10-py3-none-any.whl
.
File metadata
- Download URL: taskkill-0.10-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | afe9a939004286f4a1554056d00c7284d37a6555c3b32df542e41472b0aa7bab |
|
MD5 | 20eecda97174a6c6017a17414f8855e4 |
|
BLAKE2b-256 | 2ecf4aaca9d7317184aaf323e7faa6de983b86d6692ca1538914ee87ffe6d500 |