0

Noticed something curious today. We all (probably) know exit will end your current PowerShell session (or exit a remote PSSession). However, neither Get-Command or Get-Alias return anything for it (errors truncated below):

Get-Command exit # ==> The term 'exit' is not recognized as the name of a cmdlet....
Get-Alias exit # ====> This command cannot find a matching alias....

So... what is it?

0

1 Answer 1

4

exit is a keyword, not a command/cmdlet. See about_Language_Keywords for more information.

Others keywords (eg. if) also exhibit the same behavior when used with Get-Command / Get-Alias.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.