This is a quick module I made to make managing the PATH environment variable easier, especially when dealing with constant updates or bad MSI installers that duplicate entries. Feel free to use it.
Import-Module 'C:\Users\Tony\YourScripts\Modules\PathUtilities\PathUtilities.psd1'
-
Open your PowerShell profile for editing:
notepad $Profile
-
Add the following line to your profile file:
Import-Module 'C:\Users\Tony\YourScripts\Modules\PathUtilities\PathUtilities.psd1'
-
Save the profile file and restart PowerShell.
- Add-Path: Add directories to your PATH environment variable.
- Remove-DuplicatePaths: Remove duplicate entries from your PATH.
- Get-PathEntries: Display PATH entries by User or System.
- Remove-DuplicatesFromUserPath: Remove duplicates in the User PATH that exist in the System PATH.
- Update-Path: Update the PATH environment variable for the current session.
- Get-EnvironmentPathEntries: Retrieve the entries of the PATH environment variable for either System or User, with options for uniqueness, filtering, and raw output