Windows Vista Forums

Exit = last of the "built-in commands"?

  1. #1


    Lucvdv Guest

    Exit = last of the "built-in commands"?

    Just curious: are there any other built-in commands (in the old cmd
    terminology) left over besides "exit"?

    Exit does what I expected it to do, quit didn't do anything, and after
    finding that out I just noticed this:

    PS C:\> set-alias quit exit
    PS C:\> quit
    Cannot resolve alias 'quit' because it refers to term 'exit', which is not
    recognized as a cmdlet, function, operable program, or script file. Verify
    the term and try again.
    At line:1 char:4
    + quit <<<<

      My System SpecsSystem Spec

  2. #2


    dreeschkind Guest

    RE: Exit = last of the "built-in commands"?

    "Lucvdv" wrote:

    > Just curious: are there any other built-in commands (in the old cmd
    > terminology) left over besides "exit"?


    Well, PowerShell has its own scripting language (IMHO cmd.exe does not have
    anything that comes close to being a language) so you could just compare
    "exit" with other common language keywords like "for" "while" "switch"
    "break" etc.

    > Exit does what I expected it to do, quit didn't do anything, and after
    > finding that out I just noticed this:
    >
    > PS C:\> set-alias quit exit
    > PS C:\> quit
    > Cannot resolve alias 'quit' because it refers to term 'exit', which is not
    > recognized as a cmdlet, function, operable program, or script file. Verify
    > the term and try again.
    > At line:1 char:4
    > + quit <<<<


    Thill will work:
    PS> function exit {exit}
    PS> set-alias quit exit
    PS> quit

    or even shorter:
    function quit {exit}

    Btw.:
    I suggested that "exit" should be a customizable function like TabExpansion
    or Prompt. This would enable for example saving or cleaning up various data
    automatically (e.g. exporting history) when closing PowerShell without the
    need to remember to call a special function or cmdlet with another name.
    You can vote for this on the Connect site if you like this idea:

    https://connect.microsoft.com/feedba...8962&SiteID=99

    --
    greetings
    dreeschkind

      My System SpecsSystem Spec

  3. #3


    Alex K. Angelopoulos [MVP] Guest

    Re: Exit = last of the "built-in commands"?

    "Lucvdv" <replace_name@null.net> wrote in message
    news:n3k6l21p7sfs9bnk956rp2uqhkl4g8vrar@4ax.com...
    > Just curious: are there any other built-in commands (in the old cmd
    > terminology) left over besides "exit"?


    Technically, it's not a command; it's an internal keyword used for control
    flow, akin to break/continue/return/if and so on.

    > Exit does what I expected it to do, quit didn't do anything, and after
    > finding that out I just noticed this:
    >
    > PS C:\> set-alias quit exit
    > PS C:\> quit
    > Cannot resolve alias 'quit' because it refers to term 'exit', which is not
    > recognized as a cmdlet, function, operable program, or script file. Verify
    > the term and try again.
    > At line:1 char:4
    > + quit <<<<


    You've stumbled across one of the important points about how PowerShell
    interprets code. Here's another way to explain it.

    PowerShell starts out in "expression" mode, attempting to match tokens to
    things it understands internally: specific keywords, variables, or literal
    values. If it doesn't find a match, it then goes to statement mode and tries
    to treat the token as a command.

    Since 'quit' is not recognized internally PS now tries to treat it as a
    command, and sure enough, it's an alias for "exit". However, aliasing ONLY
    works for commands! It looks for an alias,function,filter,cmdlet, or
    external script or Windows native command named "exit" and doesn't find one.



      My System SpecsSystem Spec

Exit = last of the "built-in commands"?

Similar Threads
Thread Forum
Re: Why does exiting "server management" exit my Terminal Server session?
Please clarify what you mean by "a SBS 2003 Terminal Server" as TS is not available to run directly on a SBS 2003 box. Is this actually a separate...
SBS Server
How to restore "RUN" and "Help and Support" commands
Hi Folks. I know this is easy to do, but for some odd reason I can't get this to work. I followed about 5 different steps, that I found on Google....
General Discussion
Unwanted Multiple contacts in "To","CC","BCC" of email send catago
In the email "Contacts" address listing my contacts are listed one time which is fine. When I "Create" a new email or "Forward", "Reply" or "Reply...
Vista mail
Vista not wotking with "My Computer" or "Control Panel", "Screen Saver"
HI Folks, When I try to check contents of "My Computer", "Control Panel" the screen does a 1 second display then disappears back the Start screen....
Vista General
Cant turn off "built in protection"...
According to help section (which blows) should I just uncross the box for that program I trust and don't need Vista to block from opening... Well...
Vista security
Acer Aspire 3023 Problem enabling "radio" for built in broadcom wi
Hi, I have an Acer Aspire 3023 which has a built in broadcom 802.11g wireless card. The driver is installed by Vista during setup and shows...
Vista hardware & devices
Acer Aspire 3023 Problem enabling "radio" for built in broadcom wi
Hi, I have an Acer Aspire 3023 which has a built in broadcom 802.11g wireless card. The driver is installed by Vista during setup and shows...
Vista hardware & devices