Skip to content

Instantly share code, notes, and snippets.

@jdharmon
Created April 15, 2020 12:41
Show Gist options
  • Save jdharmon/5f2ddba6b5a3d2c6b891ae2fbae14f76 to your computer and use it in GitHub Desktop.
Save jdharmon/5f2ddba6b5a3d2c6b891ae2fbae14f76 to your computer and use it in GitHub Desktop.
function Set-WorkingDirectory($Path) {
if (-not $Path) {
$Path = "~"
}
if ((Resolve-Path $Path).Provider.Name -eq 'FileSystem') {
[System.IO.Directory]::SetCurrentDirectory($Path)
}
Set-Location $Path
}
Remove-Item alias:\cd
New-Alias cd Set-WorkingDirectory
Set-WorkingDirectory $pwd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment