Skip to content
PC Moment
Tech Tips

Command Prompt Shortcuts: History Keys, Copy and Paste, and Quick Ways to Open CMD

The Command Prompt keyboard shortcuts worth learning, the Windows Terminal keys that go with them, and fast ways to open cmd or make a desktop shortcut.

By PC MomentUpdated 7 min read

PC Moment title card for Command Prompt shortcuts and quick ways to open CMD

The Command Prompt shortcut most people never learn is F7: it pops up a list of every command you’ve run in that window, so you can pick one and run it again. Add Tab to complete file names and Ctrl + C / Ctrl + V to copy and paste, and you’ll spend a lot less time retyping.

This guide covers the shortcuts that work inside Command Prompt on Windows 10 and 11, the Windows Terminal keys that go with them, and the fastest ways to open cmd or put a shortcut to it on your desktop.

Note: On Windows 11, Command Prompt often opens inside Windows Terminal (Microsoft made Terminal the default console host in Windows 11 version 22H2). The cmd history and editing keys below work in both. The Windows Terminal section lists the extra keys for tabs and panes.

Quick ways to open Command Prompt

MethodHow
Run dialogPress Windows key + R, type cmd, press Enter
Start searchPress the Windows key, type cmd, press Enter
File Explorer address barClick the address bar, type cmd, press Enter to open cmd in that folder
Windows TerminalOpen the new tab dropdown with Ctrl + Shift + Space and choose Command Prompt
As administratorType cmd in Start search, then press Ctrl + Shift + Enter

The File Explorer trick is the one to remember if you work with files: Microsoft notes that typing cmd in the address bar launches the command shell at that location, so you don’t have to cd your way there. For all the ways to get admin rights, see our guide to the elevated command prompt.

Command history shortcuts

Command Prompt remembers what you’ve typed in the current window. These keys come from Microsoft’s doskey reference:

KeyWhat it does
Up arrowRecalls the command before the one shown
Down arrowRecalls the command after the one shown
Page UpRecalls the first command of the session
Page DownRecalls the most recent command
F7Shows all stored commands in a pop-up list
F8Shows commands that start with what you’ve already typed
F9Asks for a command number from the F7 list and recalls that command
Alt + F7Deletes all stored commands for the current history
EscClears the current line

F8 is the hidden gem. Type ipconfig, press F8, and it cycles through only the earlier commands that started with ipconfig.

To save your history to a file, run:

doskey /history > commands.txt

This writes every command stored in memory to commands.txt in the current folder.

Editing the command line

KeyWhat it does
Left / Right arrowMoves the cursor one character
Ctrl + Left / Right arrowMoves the cursor one word
Home / EndJumps to the start or end of the line
InsertSwitches between inserting and overwriting text
F1Copies the next character from your last command
F2Copies your last command up to the character you type next
F3Copies the rest of your last command
F4Deletes from the cursor up to the character you type next
F5Copies your last command into the current line

F3 is useful after a typo near the end of a long command: retype the start and press F3 to fill in the rest.

Tab completion for files and folders

Start typing a file or folder name and press Tab. Microsoft’s Windows commands reference says Tab is the default completion key for both file and directory names, so Command Prompt fills in a matching name for you. Microsoft’s cmd reference adds that completion handles names with spaces or special characters correctly when the path is in quotation marks.

Copy, paste and select text

Microsoft lists these Command Prompt shortcuts for both Windows 10 and Windows 11:

ShortcutWhat it does
Ctrl + C or Ctrl + InsertCopies the selected text
Ctrl + V or Shift + InsertPastes text
Ctrl + MEnters Mark mode so you can select with the keyboard
Alt + selectionStarts a block (rectangular) selection
Ctrl + Home / Ctrl + End (Mark mode)Moves to the start or end of the buffer
Ctrl + Up / Down arrowMoves up or down one line in the output history

Ctrl + C when nothing is selected

If no text is selected, Ctrl + C isn’t a copy. Microsoft’s console documentation explains that it’s sent as an interrupt signal to the program running in the window. That’s the usual way to interrupt a command that’s taking too long, although a program can choose to handle the signal differently. Windows Terminal works the same way: Ctrl + C copies when there’s a selection and otherwise passes the keystroke to the shell.

Windows Terminal shortcuts

If your Command Prompt runs inside Windows Terminal, these default key bindings are available too:

ShortcutWhat it does
Ctrl + Shift + TOpens a new tab
Ctrl + Shift + 1 to 9Opens a new tab with profile 1 to 9 from the dropdown
Ctrl + Shift + SpaceOpens the new tab dropdown
Ctrl + Shift + DDuplicates the current tab
Ctrl + Shift + WCloses the current pane
Ctrl + Tab / Ctrl + Shift + TabNext / previous tab
Ctrl + Alt + 1 to 8Jumps to a specific tab
Alt + Shift + DSplits the pane
Alt + arrow keysMoves focus between panes
Ctrl + Shift + FFinds text in the output
Ctrl + Shift + POpens the command palette
Ctrl + ,Opens Settings
Ctrl + plus / minus / 0Changes or resets the font size
Alt + Enter or F11Toggles full screen
Ctrl + Shift + NOpens a new window

Tip: Can’t remember a shortcut? Press Ctrl + Shift + P, start typing what you want (for example “split”), and the command palette shows the matching action and its key.

Create a Command Prompt desktop shortcut

A desktop icon is handy if you open cmd many times a day:

  1. Right-click an empty area of the desktop.
  2. Select New > Shortcut.
  3. When asked for the location of the item, type cmd.exe and select Next.
  4. Type a name, such as Command Prompt, and select Finish.

You can make the shortcut run a command when it opens by adding /k. Microsoft’s cmd reference says /k carries out the command and keeps the window open. For example, use this as the location to open cmd and immediately show your network settings:

cmd.exe /k ipconfig

Bonus: make your own command shortcuts with doskey

doskey macros let you create short names for longer commands in the current window. For example:

doskey ls=dir $*

This makes ls run dir, passing along anything you type after it (that’s what $* does). Run doskey /macros to list the macros you’ve defined.

If it still doesn’t work

  • F7 or F8 does nothing: You may be in PowerShell rather than Command Prompt. Microsoft explains that PowerShell’s command line behavior comes from its own PSReadLine module, so the doskey keys described here are for cmd. Open a Command Prompt tab or type cmd first.
  • A program ignores the keys: Microsoft notes that a program’s own key assignments override doskey keys. Some full-screen tools use F7 for something else.
  • Ctrl + V doesn’t paste in Windows Terminal: Check that you haven’t unbound or reassigned it in Terminal settings. Shift + Insert and Ctrl + Shift + V are also default paste keys.

For keyboard shortcuts outside the command line, see our list of computer tricks and the guide on how to print screen on Windows 11. Browse more in Tech Tips.

Frequently asked questions

What is the shortcut to open Command Prompt?

Press Windows key + R, type cmd and press Enter. You can also press the Windows key, type cmd and press Enter, or type cmd in File Explorer's address bar to open it in that folder.

How do I see my previous commands in Command Prompt?

Press F7 to open a list of the commands you've run in that window, then use the arrow keys and Enter to run one again. The Up arrow recalls commands one at a time, and doskey /history prints the whole list.

How do I copy and paste in Command Prompt?

Select text and press Ctrl + C (or Ctrl + Insert) to copy, and press Ctrl + V (or Shift + Insert) to paste. Ctrl + M enters Mark mode so you can select text with the keyboard.

How do I open a new tab in Windows Terminal?

Press Ctrl + Shift + T for a new tab with your default profile, or Ctrl + Shift + 1 through 9 to open a specific profile from the dropdown list.

Related guides