Moves backward through the command history, beginning with the last command typed and working back towards the first command typed.
For example, if the last command you typed was clear-host (as in our sample command history) then pressing the Up arrow key one time will display clear-host at the command prompt; you can then run this command by pressing ENTER. Pressing the Up arrow key a second time will display the command get-childitem *.dll. Pressing the key a third time displays cd c:\windows, and so on.
Moves forward through the command history. Continuing with the Up arrow example, suppose you backed your way through the command history (starting with the latest command and moving backwards towards the first command) until get-process –name “Notepad” was displayed at the command prompt. If you now press the Down arrow key you’ll move forward through the command history and get-history will be displayed. Press the Down arrow key a second time and cd c:\windows will be displayed.
Displays the first command in the command history. In our example, that causes cd c:\scripts to be displayed at the command prompt.
Displays the last command in the command history. In our example, that’s the clear-host command.
Moves the cursor one character to the left on the command line. For example, if the cursor is under the\ in command cd c:\scripts, pressing the Left arrow key will move the cursor under the :.
Moves the cursor one character to the right on the command line. For example, if the cursor is under the : in cd c:\scripts, pressing the Right arrow key will move the cursor under the \.
Moves the cursor to the beginning of the command line.
Moves the cursor to the end of the command line.
Control + Left Arrow
Moves the cursor one “word” to the left on the command line. For example, suppose the command line is displaying the command get-process –name “Notepad”; in addition, suppose that the cursor is under any of the characters in the “word” get-process. (In this case, “words” are strings of characters delineated by blank spaces.) Holding down the Ctrl key and pressing the Left arrow key will cause the cursor to move beneath the g in get-process.
Control + Right Arrow
Move the cursor one “word” to the right on the command line. For example, suppose the command line is displaying the command get-process –name “Notepad”; in addition, suppose that the cursor is under any of the characters in the “word” –name. (In this case, “words” are strings of characters delineated by blank spaces.) Holding down the Ctrl key and pressing the Right arrow key will cause the cursor to move beneath the “ in “Notepad”.
Control + c
Cancels the current command. If you are partway through typing a command and then press Ctrl+c Windows PowerShell will ignore everything you’ve typed on the line and present you with a new “blank” command line.
Creates a new command line from the partial contents of your last command line. For example, suppose your previous command was get-process –name “Notepad”. If you press F2, PowerShell will respond with the following request:
GRAPHIC – Enter char to copy up to:
If you type “ (representing the first quotation mark) PowerShell will insert the text from your previous command, up to (but not including) the double quote mark:
Note that PowerShell will always go the first instance of a character. If you type an e in the dialog box PowerShell will begin “typing” until it encounters the first e in get-process. Therefore, all that will be displayed on your screen is the following:
To cancel when asked to enter a character, press Enter without entering anything.
Displays your previous command. This is equivalent to pressing the Up arrow key once. However, while you can press Up arrow multiple times to continue cycling through your command history, pressing F3 additional times has no effect: only your last command will be displayed.
Beginning from the current cursor position, F4 deletes characters up to the specified character. For example, suppose the command get-process –name “Notepad” is displayed, and the cursor is beneath the c in process. If you press F4, the following dialog box appears:
GRAPHIC: Enter char to delete up to:
If you press – PowerShell will begin deleting characters from the command prompt and continue deleting characters until it encounters a – character. In this case, that means the following (nonsensical) command will be displayed:
If you enter a character (say, z) which does not appear in the command string then all the remaining characters in the string will be deleted:
This also occurs if you simply press ENTER when the dialog box appears.
To cancel this operation, press Ctrl+Z.
Like the Up arrow key, F5 moves you backward through the command history.
Displays a “dialog box” that allows you to select a command from your command history:
Scroll through the dialog box using the Up and Down arrow keys; when you find a command you want to execute press ENTER. Alternatively, locate the desired command and then press the right arrow key; that will “type” the command at the command prompt but will not execute that command. To then execute the command, you must press ENTER.
To dismiss the dialog box without selecting a command, press Escape.
Moves backwards through the command history, but only displays commands matching text you type at the command prompt. For example, suppose you type set and then press F8. In that case (and using our sample command history) PowerShell will only display the command set-executionpolicy. Why? Because that’s the only command in the history that matches the string set.
Now, type cd and press F8. This time around, PowerShell will display the command cd c:\windows. Press F8 a second time and the command cd c:\scripts will be displayed. That’s because, in this case, we have two commands that match the string cd.
Enables you to run a specific command from the command history. When you press F9 PowerShell prompts you to enter a command number, corresponding to the numbers displayed in the history “dialog box” (see F7):
GRAPHIC: Enter command number:
To run a command, type the appropriate number and press ENTER. Using our sample history, typing 5 and pressing ENTER runs the command get-process.
To cancel this operation, press Escape.
Hope that helps,