How to use PowerShell alias cd a spec directory?

2020-02-12 05:19发布

问题:

On Linux

alias cdt='cd /usr/a'

make a alias that when I type

cdt

I change the workpath to /use/a

On PowerShell

Set-Alias cdt "cd F://a"

It seems not work

回答1:

Aliases can't use parameters, so define a function instead.

function cdt { set-location "F:\a" }