Remove-PathVariable
Description
Removes the provided path(s) from the Environmental Path variable for a Path at the desired scope.
Requirements
PowerShell V.5
Usage
- For each given path, reload the current path environmental variable for the desired scope.
- Search that scope for the given path. If it's not present, return the current environmental path variable.
- Remove the given path from the environmental path variable and return the current environmental path variable.
.\Remove-PathVariable.ps1 -Path 'C:\Documents and Settings','C:\Config', 'C:\Recovery','C:\Intel'
This command will remove the C:\Documents and Settings
, C:\Config
, C:\Recovery
, and C:\Intel
folders from the machine-scoped environmental variable if they exist.
.\Remove-PathVariable.ps1 -Path 'C:\Documents and Settings','C:\Config', 'C:\Recovery','C:\Intel' -Scope User
This command will remove the C:\Documents and Settings
, C:\Config
, C:\Recovery
, and C:\Intel
folders from the user-scoped environmental variable if they exist.
Parameters
Parameter | Alias | Required | Default | Type | Description |
---|---|---|---|---|---|
Path | True | String[] | A list of paths to remove from the desired scope. | ||
Scope | False | Machine | System.EnvironmentVariableTarget | This designates the scoped environmental variable you wish to target: machine or user. |
Output
Standard Output