Skip to content

Instantly share code, notes, and snippets.

@kdoblosky
Created February 21, 2014 16:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kdoblosky/9137055 to your computer and use it in GitHub Desktop.
Save kdoblosky/9137055 to your computer and use it in GitHub Desktop.
# Useful $profile addition
# If my current location is at a long path elsewhere, and I need to
# switch to C:\Scripts for a moment, I can do this:
#
# $ > ~
# Do whatever I need to do in E:\Scripts
# $ > pop
# And I'm now back at my original location
# Set a folder to be considered "Home"
# Push current location to the location stack, then go to the home folder
Function Set-LocationHome() {
Push-Location
Set-Location E:\Scripts
}
Set-Alias -Name ~ -Value Set-LocationHome
Set-Alias -Name pop -Value Pop-Location
Set-Alias -Name push -Value Push-Location
# Now, if I'm at a long path elsewhere, and need to switch to C:\Scripts for a moment, I can do this:
#
# $ > ~
# Do whatever I need to do in E:\Scripts
# $ > pop
# And I'm now back at my original location
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment