Although you will usually use output redirection to store the output from command-line programs in files. You can also use copy command line and paste command line into or out of a Command window.
How to Copy Command and Paste Command from cmd:
Here’s an area where Windows 10 offers real improvements over previous versions of Windows. If you enable the new keyboard shortcut options and QuickEdit mode, you can copy command and paste text in console applications just as you would in Windows apps. The mouse cursor selects text in a natural way, and the standard Ctrl+C and Ctrl+V keyboard shortcuts copy and paste, respectively.
Enable copy and paste option in cmd:
To enable the new options, open a Command Prompt window. Right click the window’s title bar to select Properties. Select the Options tab and make the following settings to copy command line from windows:
Under Edit Options, check all four boxes.
- Quick Edit lets you select text simply by clicking and dragging the mouse cursor.
- Insert Mode inserts rather than overtypes characters by default when you backspace and type more into a command line.
- Enable New Ctrl Key Shortcuts lets you use Ctrl+C and Ctrl+V to copy and paste. And Ctrl+F to search for previous commands.
- Filter Clipboard Contents on Paste removes tabs from pasted text and turns “quotes” quotes and dash characters into their simple
Under Text Selection, check both boxes.
- Enable Line Wrapping Selection makes the cursor select text the way it does in a word processor. If you need to use the old rectangular mode, just hold down the Alt key while selecting text.
- Extended Keys enables a bunch of keyboard shortcuts. You can use it to adjust the range of selected text before you copy it to the Clipboard.
While you’re at it, select the Layout tab and check Wrap Text Output on Resize. With this option checked, if text output in the console window wraps onto multiple lines. You can enlarge the window to untangle it.
The Extended Edit Keys option enables shortcuts such as:
- Ctrl+A to select all text in the command window,
- Ctrl+M to start “marking” (selecting) text at the cursor position, and
- Shift+End to extend the selection to the end of the current line.
But there are way more new keyboard tricks than we can describe in our limited space here. If you’re interested, click here to find keyboard shortcut
If you use old console applications or MS-DOS applications and they stop working correctly when you enable these new keyboard and mouse options, try disabling QuickEdit mode. If that doesn’t help, check Use Legacy Console on the Options tab of the Properties page. This makes Windows revert to the same console window code that it used in Windows XP through 8.1.
Paste command using the old method:
By the way, even with the new options enabled, the old methods of copying and pasting still work. To paste command text into the window at the cursor location the old way, you can right-click on window’s bar and then select Edit, Paste. Or you can use the keyboard press Alt+spacebar and type E P.
Copy command using the old method:
To copy command text from the window to the Clipboard the old way, right-click the title bar and select Edit, Mark. Alternatively, use Alt+Spacebar then type E M. Use the mouse to highlight an area of the screen and then press Enter. This copies the text to the clipboard.