PowerShell: Get Out Of Directories Fast

by Doug Finke on August 18, 2013

Working at the command line, I often find I’m deep down in directories. I need to travel up and over to different parts of the tree. Here are functions I put in my $PROFILE to move up multiple directories, quickly by typing in two characters like u3.

The PowerShell

function .. ($up=1) {1..$up | ForEach {cd ..} }

function u2 { .. 2 } function u3 { .. 3 } function u4 { .. 4 } function u5 { .. 5 }

PowerShell In Play

image

{ 2 comments… read them below or add one }

Jason Jarrett 08.18.13 at 2:43 pm

This link talks a bout a re-written CD command I wrote. Hope you find it useful

http://elegantcode.com/2012/11/01/more-than-slightly-modified-cd-command-for-powershell/

Keith Hill 08.18.13 at 9:21 pm

And PSCX has had “cd ….” for a long time as well as cd – / cd + / cd $profile / cd c:\look ma spaces and no quotes :-)

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>