Replace cd with z in Powershell #960
Unanswered
AzureHound
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I’m using PowerShell 7 on Windows 11, and I’d like to replace the default cd command with z (from Zoxide) so that whenever I type cd, it behaves like z.
I tried a couple of approaches, but I’m running into issues. Specifically:
Setting an alias: I tried Set-Alias cd z, but the built-in cd still interferes, and it doesn’t give me the desired behavior.
Using Invoke-Expression: I also tried adding --cmd cd with Invoke-Expression like this:
Invoke-Expression (& { (zoxide init --cmd cd powershell | Out-String) })
but that didn’t seem to work either.
Has anyone successfully overridden or aliased cd to z in PowerShell? Or is there a better way to make z the default navigation command instead of cd? Any suggestions or guidance would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions