pathmod
Introduction
pathmod is a CLI program which allows you to easily modify the PATH using the terminal on Windows. pathmod can persistently modify the PATH, and provides an easy way to refresh the path in the current session.
Requirements
You need to have Python 3.6 or higher installed. This will allow you to install pathmod with Python's package manager, pip.
How to install
To install pathmod with pip:
pip install pathmod
After this command completes, the pathmod executable should be available on the PATH.
Quick start
User vs system PATHs
By default, pathmod modifies the user PATH, which does not require elevated permissions. You can use the -s/--system flag to modify the system PATH instead.
Add
add is used to add an item to the PATH.
You can use relative paths, and paths using tilde (~):
# Add the current working directory to the PATH.
>> pathmod add .
# Add 'C:\Users\%USERNAME%\scripts' to the PATH.
>> pathmod add ~/scripts
Absolute file paths are also valid:
>> pathmod add "C:\Program Files\my program"
Prepend
prepend is used to prepend an item to the PATH. THis may be useful if you require items in your newly added location to be prioritised over items of the same name in other locations.
>> pathmod prepend .
Remove
pathmod remove is used to remove an item from the PATH.
>> pathmod remove .
As with add and prepend, this defaults to modifying the user PATH. To remove an item from the system PATH, ensure you use the -s/--system flag:
>> pathmod remove . -s
Show
show is used to show the items currently on the user and system PATHS. This prints the persistent values - the values which will be present in a new session - rather than the values in the current session.
>> pathmod show
----------------------------------------------------------------------
Path Location
----------------------------------------------------------------------
[user] 'C:\Users\username\AppData\Local\Programs\Python\Python39\Scripts\'
[user] 'C:\Users\username\AppData\Local\Programs\Python\Python39\'
...
[system] 'C:\Windows\system32'
[system] 'C:\Windows'
...
Refresh
refresh allows you to update the PATH in the current session. This is especially useful in terminals such as the Windows Terminal, where you would need to open a new terminal instance and be unable to migrate your tabs.
Updating the PATH directly from pathmod is not possible because pathmod cannot modify the environment of its parent process; however, a relatively easy workaround is to run the command:
Invoke-Expression $(pathmod refresh -gq)
This will update the PATH in your current session so that it is equivalent to the PATH which would be used in a new session.
Help
You can use the --help flag to show help info. This also works for subcommands.
License
You may freely use, modify and redistribute this program under the terms of the MIT License. See LICENSE.
Metadata
Release files for pathmod 0.1.0
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 |
|---|---|---|---|---|
| pathmod-0.1.0.tar.gz | 9.1 kB | Without provenance | Details for pathmod-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pathmod-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for pathmod-0.1.0-py3-none-any.whl |
Total release size: 21.6 kB
Release files / pathmod-0.1.0.tar.gz
| Download URL | pathmod-0.1.0.tar.gz |
|---|---|
| Size | 9.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c8bfbcebae052892ebf3c516642617e7aa6f01bec3d22131640038e1152fa064
|
|
BLAKE2b-256 checksum How to use checksums |
ec285d24aa47dffeee63b91b3d8f2c386daf8c51d42828bdf470acfcae51ab8a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.1
|
Release files / pathmod-0.1.0-py3-none-any.whl
| Download URL | pathmod-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8097d9dc1ce940cba3d5225c6215b609ca6ba74d63230701128702ad9677c7e9
|
|
BLAKE2b-256 checksum How to use checksums |
a85deeafb48856c15b208e93777a08508ed3f8ee42613d29d63dfd6bd43c2d3b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.1
|
Security for pathmod 0.1.0
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.