Skip to content

Instantly share code, notes, and snippets.

@AKuederle
Last active August 29, 2015 14:14
Show Gist options
  • Save AKuederle/509b5710445cb9706155 to your computer and use it in GitHub Desktop.
Save AKuederle/509b5710445cb9706155 to your computer and use it in GitHub Desktop.
Get and refresh the currently avaible path inside a PowerShell session (usefull, when troubleshooting or installing things from the shell)
# prints the current path avaible in the PowerShell
function path
{
$curr = Get-Location
cd env:
(ls path).value.split(“;”)
cd $curr
}
# refreshs the current path and refreshs the profile script to consider any path manipulation made there.
function refpath
{
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
. $PROFILE
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment