# 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
```python
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.
Raw data
{
"_id": null,
"home_page": "https://github.com/hansalemaos/taskkill",
"name": "taskkill",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "taskkill",
"author": "Johannes Fischer",
"author_email": "aulasparticularesdealemaosp@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/5e/a6/9c6059c04669a1d27b74dea03aa06112e305020d5e58566f0344990b5c30/taskkill-0.10.tar.gz",
"platform": null,
"description": "# terminating processes on Windows using the taskkill command\r\n\r\n## Tested against Windows 10 / Python 3.10 / Anaconda \r\n\r\n### pip install taskkill\r\n\r\ntaskkill 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.\r\n\r\n### Features\r\n\r\n- Kill processes by PID\r\n- Terminate processes along with their child processes\r\n- Forcefully terminate processes\r\n- Search and terminate processes using regex-based criteria\r\n- Dry run option to preview processes without actually terminating them \r\n\r\n\r\n\r\n```python\r\n\r\nfrom taskkill import taskkill_pid, taskkill_pid_children, taskkill_force_pid, taskkill_force_pid_children, taskkill_regex_rearch\r\n\r\n# Kill processes by PID\r\nresults = taskkill_pid(pids=(1234, 5678))\r\n\r\n# Terminate processes along with their child processes\r\nresults = taskkill_pid_children(pids=(1234, 5678))\r\n\r\n# Forcefully terminate processes\r\nresults = taskkill_force_pid(pids=(1234, 5678))\r\n\r\n# Forcefully terminate processes along with their child processes\r\nresults = taskkill_force_pid_children(pids=(1234, 5678))\r\n\r\n# Search and terminate processes using regex-based criteria\r\nresults = taskkill_regex_rearch(\r\n dryrun=False,\r\n kill_children=True,\r\n force_kill=True,\r\n title=r\"\\bnotepad$\",\r\n windowtext=\".*\",\r\n class_name=\".*\",\r\n path=\"notepad.exe$\",\r\n)\r\n\r\n# Dry run - Preview processes without terminating them\r\ntaskkill_regex_rearch(\r\n dryrun=True,\r\n kill_children=True,\r\n force_kill=True,\r\n title=r\"\\bnotepad$\",\r\n flags_title=re.I,\r\n windowtext=\".*\",\r\n flags_windowtext=re.I,\r\n class_name=\".*\",\r\n flags_class_name=re.I,\r\n path=\"notepad.exe$\",\r\n flags_path=re.I,\r\n)\r\n```\r\n\r\nContribution\r\nContributions 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.\r\n\r\nLicense\r\nThis project is licensed under the MIT License.\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "terminating processes on Windows using the taskkill command",
"version": "0.10",
"project_urls": {
"Homepage": "https://github.com/hansalemaos/taskkill"
},
"split_keywords": [
"taskkill"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2ecf4aaca9d7317184aaf323e7faa6de983b86d6692ca1538914ee87ffe6d500",
"md5": "20eecda97174a6c6017a17414f8855e4",
"sha256": "afe9a939004286f4a1554056d00c7284d37a6555c3b32df542e41472b0aa7bab"
},
"downloads": -1,
"filename": "taskkill-0.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "20eecda97174a6c6017a17414f8855e4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 6450,
"upload_time": "2023-05-28T05:58:34",
"upload_time_iso_8601": "2023-05-28T05:58:34.220435Z",
"url": "https://files.pythonhosted.org/packages/2e/cf/4aaca9d7317184aaf323e7faa6de983b86d6692ca1538914ee87ffe6d500/taskkill-0.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5ea69c6059c04669a1d27b74dea03aa06112e305020d5e58566f0344990b5c30",
"md5": "8ad2e9baab5cde02819531bb1d62700c",
"sha256": "5586bf9b8f81d9aa0b52989e1afc0839728fe56d390276d20d98e34f5c0a14c7"
},
"downloads": -1,
"filename": "taskkill-0.10.tar.gz",
"has_sig": false,
"md5_digest": "8ad2e9baab5cde02819531bb1d62700c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5427,
"upload_time": "2023-05-28T05:58:36",
"upload_time_iso_8601": "2023-05-28T05:58:36.475536Z",
"url": "https://files.pythonhosted.org/packages/5e/a6/9c6059c04669a1d27b74dea03aa06112e305020d5e58566f0344990b5c30/taskkill-0.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-28 05:58:36",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "hansalemaos",
"github_project": "taskkill",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "taskkill"
}