![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| 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 <<<< |
| | #2 (permalink) |
| 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 |
| | #3 (permalink) |
| 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. |
| |
| |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Unwanted Multiple contacts in "To","CC","BCC" of email send catago | xsailer | Vista mail | 1 | 4 Weeks Ago 08:34 AM |
| Vista not wotking with "My Computer" or "Control Panel", "Screen Saver" | Platebanger | Vista General | 6 | 02-05-2008 08:54 AM |
| Cant turn off "built in protection"... | esmnh | Vista security | 6 | 08-21-2007 07:00 PM |
| Acer Aspire 3023 Problem enabling "radio" for built in broadcom wi | Chris | Vista hardware & devices | 3 | 06-21-2006 09:28 AM |
| Acer Aspire 3023 Problem enabling "radio" for built in broadcom wi | Chris | Vista hardware & devices | 6 | 06-14-2006 08:13 PM |