Search code examples
powershellaliascd

Powershell alias for "cd .."


I want to create an alias for cd .. as .. in powershell.

I've tried to following variations but to no avail.

Set-Alias ".." "cd .."
Set-Alias ".." { set-location "cd .." }
Set-Alias ".." { set-location ".." }

Solution

  • It would have to be a function, since it has arguments:

    function .. { set-location .. }
    

    There's actually a function already called "cd.." with no spaces, to mimic cmd. So you could also do:

    set-alias .. cd..