The missing sudo command for win32
Project description
template-python-cmd
A template for quickly making a python lib that has a command line program attached
Usage
pip install sudo_win32
sudo_win32 taskkill /F /im wslservice.exe
Note that the command is recommended to be a string. If this isn't done, then the command will be concatenated using subprocess.list2cmdline.
If this package solves a problem in your life then you are obligated to give this repo a star. If you don't, then you are a bad person.
How this works
I discovered this solution while at Google and did a proper implementation of it.
This command executes an elevated command in windows. Very tricky. Many articles have been written about this topic. This is the best solution I could find is to use a mix of batch programs and powershell:
- Powershell is used to execute a batch file and raises the privledges to admin level.
- The batch file a. executes the command as admin. b. echoes "done" to a file as a normal user
- The calling python waits until the "done" file appears then exits.
Development
To develop software, run . ./activate.sh
Windows
This environment requires you to use git-bash
.
Linting
Run ./lint.sh
to find linting errors using pylint
, flake8
and mypy
.
Release Notes
- 1.0.0 - Initial release
Project details
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
Hashes for sudo_win32-1.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5658f2ff59a9f59926a2227207df6270dc2896acaf8b3a6198cc1862fbfd746b |
|
MD5 | 39adf6038eacc0fcabdcbd59f1dd4283 |
|
BLAKE2b-256 | 8d3673985c9dd7ad7b4344cb8fe04af1793d0c1ee8c1012cd5ea780469a13d8c |