Introduction to Windows PowerShell

1 2 3 4 5 6 7 8 9 10 11 12 Page 5
Page 5 of 12

There are some other function keys that you might want to know about. These shortcuts actually work in any Powershell or Command Prompt window, and with any console application:


Does the following...


F2 followed by a single character copies text from the previously entered command line into the current command line, up to but not including the first occurrence of the character you type. For example, if the previous command was

get-childitem c:\temp | get-member

then pressing F2 | copies get-childitem c:\temp into the current input line.


Types in whatever was in the previous command line from the cursor position to the end of the line. For example, if you mistype a single character in a command line:

fet-childitem c:\temp

and don’t realize it until you’ve pressed Enter, just type g and then press F3 to recall the rest of the line. You’ll end up with

get-children c:\temp.


F4 followed by a single character deletes text from the cursor up to but not including the first occurrence of that character.


Pops up a list of recently typed commands. You can scroll through it using the arrow keys and press Enter to reissue the command.


Lets you type in the number of a previous command. The numbers are the ones shown in the F7 pop-up. (This one would have been useful if the numbers ran backward, so that 3 meant the third command back, but they don’t, so it’s not.)

To be honest, you can work through an entire IT career without ever using these F-key shortcuts and not suffer for it, but if you can manage to remember them, they could come in handy some day. I keep meaning to remember F7, but I never do.

Copying and Pasting

Copying and pasting in the PowerShell environment works exactly as it does in any Command Prompt or console program window, again, because PowerShell is a normal console program, just like cmd.exe.

You can’t cut text out of the window; you can only copy text from a rectangular region to the clipboard. To copy from the PowerShell screen with the mouse, click the upper-left corner of the PowerShell window and select Edit, Mark. Point to the upper-left corner of the text you want to copy, press the mouse button, and drag to the lower-right corner of the text you want. Then, right-click the screen, or press Enter, to copy the text.

Note - If all the text you want isn’t visible, remember that you can scroll the window up and down during the process.

There are also keyboard shortcuts for these steps. Press Alt+Space E K to begin. You can then use the arrow keys to move the cursor to the upper-left corner of the desired text; then, hold down Shift and while holding it, use the arrow keys to move to the lower corner. Press Enter to complete the operation.

Personally, I find it easiest to type Alt+Space E K to start, switch to the mouse to mark the rectangle, and then go back to the keyboard to press Enter.

To paste text from the clipboard into the PowerShell window, click the upper-left corner of the window and select Edit, Paste. You might find it quicker to use to the keyboard shortcut: Alt+Space E P.

1 2 3 4 5 6 7 8 9 10 11 12 Page 5
Page 5 of 12
7 inconvenient truths about the hybrid work trend
Shop Tech Products at Amazon