Replace cd with z in Powershell #960
Unanswered
AzureHound
asked this question in
Q&A
Replies: 1 comment
-
Strange, Invoke-Expression (& { (zoxide init --cmd cd powershell | Out-String) }) works for me, did you place it in the right place? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
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