add2winpath
Adds/removes folders to the PATH on Windows (Current User/All Users). It doesn't spoil paths with variables (e.g. %windir%\system32)
pip install add2winpath
Tested against Windows 10 / Python 3.10 / Anaconda
Usage
# Adds "folders" to the path (beginning) and removes "remove_from_path",
# the function doesn't mess around with file paths containing variables like "%windir%\system32"
from add2winpath import add_to_path_all_users,add_to_path_current_user,get_all_subfolders_from_folder
cva0 = add_to_path_current_user(
folders=[
"c:\\cygwin\\bin",r"C:\baba ''bubu"
],
remove_from_path=["c:\\cygwin"],
beginning=True,
)
cva1 = add_to_path_all_users(
folders=["c:\\cygwin\\bin", "c:\\cygwin"],
remove_from_path=["c:\cygwin3"],
beginning=True,
)
allsubfolders = get_all_subfolders_from_folder(
folders=[r"C:\cygwin\var\lib\rebase"]
) # list of all subfolders
add_to_path_all_users
add_to_path_all_users(folders: Union[str, List[str]], remove_from_path: Union[str, List[str]], beginning: bool = False) -> str
Adds the specified folders to the PATH environment variable for all users on the system.
Args:
folders (Union[str, List[str]]): A string or list of strings representing the folders to be added to the PATH.
remove_from_path (Union[str, List[str]]): A string or list of strings representing the folders to be removed from the PATH.
beginning (bool, optional): A boolean indicating whether the folders should be added to the beginning or end of the PATH. Defaults to False.
Returns:
str: A string representing the registry script that was executed to update the PATH environment variable.
add_to_path_current_user
add_to_path_current_user(folders: Union[str, List[str]], remove_from_path: Union[str, List[str]], beginning: bool = False) -> str
Adds the specified folders to the PATH environment variable of the current user.
Args:
folders (Union[str, List[str]]): The folder(s) to be added to the PATH environment variable.
remove_from_path (Union[str, List[str]]): The folder(s) to be removed from the PATH environment variable.
beginning (bool, optional): If True, the specified folders will be added to the beginning of the PATH variable.
If False, the specified folders will be added to the end of the PATH variable. Defaults to False.
Returns:
str: The string representation of the registry key that was added to the Windows registry.
get_all_subfolders_from_folder
get_all_subfolders_from_folder(folders: Union[str, List[str]]) -> List[str]
Returns a sorted list of unique subfolder names contained within the specified folder(s).
Args:
folders (Union[str, List[str]]): A string representing the path(s) to the folder(s) to search for subfolders.
Returns:
List[str]: A sorted list of unique subfolder names contained within the specified folder(s).
Metadata
Release files for add2winpath 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 |
|---|---|---|---|---|
| add2winpath-0.10.tar.gz | 6.0 kB | Without provenance | Details for add2winpath-0.10.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| add2winpath-0.10-py3-none-any.whl | Python 3 | none | any | Details for add2winpath-0.10-py3-none-any.whl |
Total release size: 14.2 kB
Release files / add2winpath-0.10.tar.gz
| Download URL | add2winpath-0.10.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
76c1c37fa51aa85c891408add449bb1952371b2666d1555e370276787653831c
|
|
BLAKE2b-256 checksum How to use checksums |
0f611fba9f65270a4826a676ff78599ed2bcf42075d953722e69b0a09c7eb23a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.10
|
Release files / add2winpath-0.10-py3-none-any.whl
| Download URL | add2winpath-0.10-py3-none-any.whl |
|---|---|
| Size | 8.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0942089a1a6fe255a372d058f7a8c5db7d8fa378dc529ffd82840d82d644aef3
|
|
BLAKE2b-256 checksum How to use checksums |
d2df8a2ec2afdee99976b8ca15c8337ce402c581c6add866b0e72f5b7e7a95a7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.10
|
Security for add2winpath 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.