Industry guru Dave Taylor offers tech support on technical and business topics, including iPhone, iPod, Microsoft Windows, Sony PSP, cellphones, online advertising, CSS, Web design, business, Unix, Linux, SEO, Mac OS X, and shell script programming.     


How do you copy and paste within a Windows command prompt?

I know how to open a command prompt in Microsoft Windows, but the normal methods for cutting and copying and pasting -- like Ctrl-C and Ctrl-V -- don't seem to work inside a command prompt window. How can I do copying and pasting with a command prompt?


Dave's Answer:

It's possible to copy and paste within a Microsoft Windows command prompt, and to copy and paste text to/from other programs, but the commands and keyboard keys to do so are different from most other Windows programs.

Pressing Ctrl-C and Ctrl-V do not work, and selecting text within a command prompt to copy, requires a few more steps.

To paste text within a command prompt that has been copied from another program, is the easiest. Simply copy the text from the other program, then right-click inside the command prompt window and pick "Paste":

paste in command prompt

To copy text from a command prompt is a bit more awkward. As you know from using Microsoft Word and many other programs, when you select text on the screen, the selection runs from the first word you selected, to the last word:

microsoft word selected text

Inside a command prompt, on the other hand, the "selected" text doesn't run from the first selected word, in straight lines from left to right across the command prompt window, to the last selected word. Instead, you can only select text within a command prompt that lies inside a perfect rectangle!

For example, suppose you were trying to type "ipconfig" inside a command prompt, and you accidentally typed "ioconfig" and got this error message:

command prompt error message

You want to copy this error message and e-mail it to your friend to ask them what went wrong. To select text within the command prompt window, first right-click anywhere inside the command prompt and pick "Mark":

command prompt mark

Then, to select text, you left-click inside the command prompt window, and drag the mouse pointer to create a rectangle outlining the text that you want to copy:

command prompt partial rectangle

And then to actually copy the selected text, hit the Enter key. Observe that in this case, the selection really did only include the text inside the rectangle, rather than running to the end of the line, back to the beginning of the next line and so on. So if you paste the selected text into another program, it really will only paste the text that was included in the rectangle:

pasted partial rectangle

(It's a bit difficult to explain why text selection works this way in a command prompt, but it has to do with the history of the command prompt interface, which goes all the way back to DOS, the forerunner of Microsoft Windows from the 1980s. Essentially, the command prompt interface only "knows" that its output consists of a pattern of characters that are displayed in certain fixed positions on the screen, in a grid that happens to be exactly 80 characters wide and 45 lines high. These characters could be text, or graphics from a primitive computer game that displayed graphics by filling the screen with letters in a certain pattern -- the command prompt doesn't "know" that the characters consist of text, and that the user wants to select a block of text that runs to the end of the line, then starts at the beginning of the next line, and so on. Just realize that Microsoft didn't design the command prompt interface this way just to screw with you.)

So to copy the entire text of the error, you have to click and drag a rectangle around the entire text that you want to select:

command prompt entire rectangle

and then hit Enter to copy the text to your clipboard. Then you can paste it in an e-mail message to your friend.

Bennett Haselton is a technology and political blogger who writes guest articles for AskDaveTaylor, but his real passion lies elsewhere, like telling people how to bypass 8e6 filtering software.


More Useful Windows PC Help Articles:
✔   What's the easiest way to speed up my Windows PC laptop?
My Dell Windows 7 laptop is starting to drive me crazy. It's so darn slow! I've had it a few years and I...
✔   Can I force a Windows 7 OS system update?
Every so often Windows 7 pops up a window and tells me that there are updates. That's nice, but how can I force...
✔   Fix Google Drive (Gdrive) no longer supported (out of date)?
I'm a big Google fan and have been using Google Drive for quite a while as a cloud storage device. It's a breeze,...
✔   How do I open or unpack a RAR archive on my Windows PC?
I have some ".rar" files on my Windows 8 PC and am curious how to unpack them to see what's inside. From a...
✔   How can I shrink my Windows 8 Desktop file icons?
I've figured out most things in the new Windows 8 interface, except I can't see how to easily reduce or shrink the file...

Let's stay in touch!
Sign up for my weekly AskDaveTaylor Newsletter and you'll receive even more tech and gadget help right to your inbox, along with exclusive news and industry updates. It's good stuff. I promise!
    Enter your name: and your email addr:  









Reader Comments To Date:

Starbucks coffee cup I do have a lot to say, and questions of my own for that matter, but first I'd like to say thank you, Dave, for all your helpful information by buying you a cup of coffee!
Rather amazingly, there are no comments on this article yet.

I do have a comment, now that you mention it!











I will never send you any unsolicited email. Ever.






Check This Out Too...

 
Look for Answers
Need Help? Ask Dave Taylor!


Follow Me on Pinterest

Find Me on Google+
ADT on G+
© 2002 - 2013 by Dave Taylor. All Rights Reserved.

Note: This web site is for the purpose of disseminating information for educational purposes, free of charge, for the benefit of all visitors. We take great care to provide quality information. However, we do not guarantee, and accept no legal liability whatsoever arising from or connected to, the accuracy, reliability, currency or completeness of any material contained on this web site or on any linked site. Further, please note that by submitting a question or comment you're agreeing to my terms of service, which are: you relinquish any subsequent rights of ownership to your material by submitting it on this site. My lawyer says "Thanks".
"Ask Dave Taylor®" is a registered trademark of Intuitive Systems, LLC.