Powershell functions
From wikinotes
Function _AppendToPathEnv {
param (
[Parameter (Mandatory=$true, position=2)]
[String]$value
)
# """ Appends a value to registry key, if it does not already exist within (HKCU) %PATH%.
# """
if (!(_IsPathInHKCU)){
Set-ItemProperty -Path 'Registry::HKCU\Environment' -Name PATH -Value ($value+ ";")
} else {
$PATH = Get-ItemProperty -Path 'Registry::HKCU\Environment' -Name PATH
if (!($PATH.Path.Split(';').Contains($value))){
Set-ItemProperty -Path 'Registry::HKCU\Environment' -Name PATH -Value ($PATH.Path +";"+ $value + ";")
}
}
}
_AppendToPathEnv "C:/your/path"