Path 0.2.0
See the version list below for details.
dotnet tool install --global Path --version 0.2.0
dotnet new tool-manifest # if you are setting up this repo dotnet tool install --local Path --version 0.2.0
#tool dotnet:?package=Path&version=0.2.0
nuke :add-package Path --version 0.2.0
path
Path is a command-line tool to manage PATH environment variable on Windows. It's a successor to my PathCleaner project.
installation
Specifying version is required for pre-release projects on NuGet:
dotnet tool install path --global
⚠️warning
Messing with your PATH can easily cause your system to break or your applications to stop running. Use only if you know what you're doing. You've been warned.
why
PATH management in operating systems is inconsistent among platforms (even shells), and it's unnecessarily cumbersome. PATH variable gets cluttered over time too with many orphaned entries unnecessarily creating miniscule but non-zero overhead. This tool is mostly a UX experiment on how to make PATH management from command-line better. Although only Windows is supported currently, the ultimate goal is to make this tool the standard syntax for interacting with paths on any OS.
I also wanted to develop a tool with .NET 6 + System.CommandLine + Spectre.Console to learn more about them. I also learned a lot about GitHub Actions while coding this. Love all of them so far!
usage
Add a directory to user PATH:
path add C:\some\new\path
Want to add it to the machine-level PATH? Run this on an elevated prompt instead:
path add C:\some\new\path --global
Want to remove all instances of a directory from a PATH with a single command? Here it is:
path remove C:\some\existing\path\
Directories in PATH are searched in the order of addition. Want to move a directory higher up in the PATH? This command will move the directory to the beginning of the PATH:
path move C:\some\new\path top
Want to move a directory after another directory?
path move C:\some\new\path after C:\Windows
or before?
path move C:\som\new\path before C:\Windows
Over time, PATH might get cluttered with empty, orphaned folders without any executables in them. Use "analyze" command to find them:
path analyze
Analyze can also automatically fix the problems for you:
path analyze --fix
You might be scared of what fix will do, so you can run the same fix command with the --whatif
argument:
path analyze --fix --whatif
license
MIT license. See LICENSE.md file for details.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
This package has no dependencies.
Version | Downloads | Last updated |
---|---|---|
0.2.2 | 87 | 9/29/2024 |
0.2.1 | 73 | 9/26/2024 |
0.2.0 | 79 | 9/26/2024 |
0.1.3 | 76 | 9/25/2024 |
0.1.2-alpha | 163 | 3/5/2022 |
0.1.1-alpha | 127 | 2/28/2022 |