HomeWindows 7 Tutorial

Copy/paste text in Windows command line (DOS prompt)

1Copy paste text in DOS prompt - Step 1

Unlike a regular text editor, you can't the use standard keyboard shortcuts to select all, cut, copy, or paste (Ctrl+A / Ctrl+X / Ctrl+C / Ctrl+V) in the "DOS prompt" command line window in Windows 7. In fact, you can't cut text at all. But there are ways to achieve the same effect, using various tricks / shortcuts. The same holds true for PowerShell, another Microsoft command line tool.

2Copy paste text in DOS prompt - Step 2

To select text in PowerShell, you can drag to select, (nearly) like you can in a regular text editor. To select text in a DOS command prompt window, you have to select all - you can't be "selective" :) Right-click on the prompt window and choose "Select All" (or hit the S access key when the context menu opens). The background becomes white, and selected text shows up in black.

3Copy paste text in DOS prompt - Step 3

To copy, Ctrl+C won't work: that clears the selection and that's it! Right-clicking again goes nowhere either. Instead, click on the app icon to show the system menu (see screenshot), and go to Edit > Copy. Noticed the word "Enter" on the right of the copy command in the submenu? That's your keyboard shortcut to copy selected text in the Windows command line / PowerShell window.

4Copy paste text in DOS prompt - Step 4

In PowerShell, you can paste simply by right-clicking anywhere on the window: the text from your clipboard will automatically be inserted at the blinking insertion point. In the standard Windows command line, you can click on the DOS prompt icon and choose Edit > Paste - the bonus steps shows shortcuts.

5Copy paste text in DOS prompt - Step 5

Productivity shortcuts for "DOS" prompt (Windows command line):
- The quickest way to select all is to right-click and hit S. To do it with the keyboard only, hit Alt+Space: that's the universal hotkey to show a program's system menu. Then, hit E for Edit and S for Select all.
- To copy, hit Enter or Alt+Space, then E and C.
- To paste, hit Alt+Space, then E and P.

*Copy paste text in DOS prompt - Step 6

Bonus Step - "cut" text in DOS prompt / PowerShell. Neither console supports cutting, so work around that by using the file output redirection operator. It's just a closing angular bracket (>) at the end of the command to show its output in a text file, whose name you type on the right. You can copy a command's output to the clipboard by adding the pipe character (|) and word "clip" at the end. ("ipconfig" is the tool we used to get a PC's private / internal IP address.)