Improve PowerShell commandline navigation


This post is about improving PowerShell in order to ease navigation on the commandline. There are some pretty cool solutions out there which I have added to my profile to be able to move around quicker:

Another one, that I came up with is in order to move down directory paths quickly similar to ‘cd ..’:

      #if the command is only dots
      if ($CommandName -match '^\.+$'){
                  for ($counter=0;$counter -lt $CommandName.Length;$counter++){
                        Set-Location ..

Adding those lines to your profile (I believe v3 is required for this to work) will enable you to move down directory paths quickly by using just dots where the number of dots determines how many levels you move down the folder hierarchy. If you are for example within “PS>c:\test1\test2\test3\test4” the command “…” will move you down 3 levels to “PS>c:\test1”.


photo credit: dusk tusks via photopin (license)