While playing with PowerShell I noticed that it has pretty good support for the behavior found in "old" CMD and/or "DOS", all the function keys work just as expected
Now, in case you don't know how to use the function keys in "DOS" here are some pointers:
F1 - will repeat the last command one character at a time, so if your last command was "dir", you will get "d", "i", "r" as you press F1 multiple times
F2 - "Copy up to char" function (of the last entered command): Not used much, it allows you to copy up to the character you enter after pressing F2, e.g.
If you previously entered: dir "program files"
on the next line you could enter: dir [F2]m
and it would complete it as: dir "progra
F3 - repeats the last command
F4 - "delete up to", I can't really remember how to use this one, but is rarely used I guess
F5 - iterate backwards through the list of previously entered commands (same as using the up arrow key)
F6 - ^Z or text file terminator: I can't see how to use this in PS, but if you were entering a text using "copy con [filename]" you can get out of it and save the file by pressing F6, which by the way, PS doesn't have support for "copy con" but supposedly this guy wrote something equivalent to it:
http://tfl09.blogspot.com/2005/10/monad-and-command-console.html
F7 - Provides a list of the previously entered commands and you can select one using the arrow keys
F8 - Iterates in a loop backwards (when it gets to the first one it goes the last one) through the previously entered commands
F9 - "Enter command number": allows you to enter the command number you want to execute, to find out the command numbers you would have to use F7 first
technorati tags:microsoft, powershell, command, compatibility
Blogged with Flock
4 comments:
Thanks for the mention. Yes I did create a simple CopyfromConsole function. The script on reskit.net, which you kindly linked to in your post, also creates an alias "copycon".
This is the sort of function that you'd put in your start-up script so that you can use it whenever you need it.
Also, Tony is right, PowerShell is hosted inside the console, thus the CMD.EXE command line behaviour is indeed supported. But there's some improvemements, e.g. command history.
command history has been supported for quite a while in cmd and DOS, what's the improvement in that area?
History becomes an object you can manipulate programatically, rather than simply through the keyboard.
Take a look at http://www.microsoft.com/technet/scriptcenter/topics/msh/cmdlets/get-history.mspx and http://www.microsoft.com/technet/scriptcenter/topics/msh/cmdlets/add-history.mspx for some of the basics.
I see, pretty cool
thanks!
Post a Comment