CLI tool for easily modifying the PATH (persistently) on Windows.
Project description
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.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pathmod-0.1.0.tar.gz.
File metadata
- Download URL: pathmod-0.1.0.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8bfbcebae052892ebf3c516642617e7aa6f01bec3d22131640038e1152fa064
|
|
| MD5 |
7ca9f8db986030104e9fad2a2e620683
|
|
| BLAKE2b-256 |
ec285d24aa47dffeee63b91b3d8f2c386daf8c51d42828bdf470acfcae51ab8a
|
File details
Details for the file pathmod-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pathmod-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.5 kB
- Tags: Python 3
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8097d9dc1ce940cba3d5225c6215b609ca6ba74d63230701128702ad9677c7e9
|
|
| MD5 |
b1ea79666a11343f2fec58cbf718505a
|
|
| BLAKE2b-256 |
a85deeafb48856c15b208e93777a08508ed3f8ee42613d29d63dfd6bd43c2d3b
|