This PowerShell script, AddToUserPath.ps1, adds a specified directory to the user's PATH environment variable in PowerShell 7. By default, it adds a 'Bin' directory located in the user's home directory.
- By default, the script adds a 'Bin' directory (
$HOME\Bin) to the PATH. - Optionally, a custom path can be specified as a command line argument.
-
To add the default 'Bin' directory in the user's home to the PATH:
.\AddToUserPath.ps1 -
To add a custom path:
.\AddToUserPath.ps1 -PathToAdd "C:\Your\Custom\Path"
- PowerShell 7 or higher.
- Ensure that the custom path provided is valid and correctly formatted.
- This script modifies the user's PATH environment variable and should be used with understanding of the implications.