Useful copy/paste trick in CMD.EXE


Many people have trouble doing copy/paste in CMD.EXE. Indeed, there are no keyboard shortucts for this thing, and the selection of the text to copy can only be done through the mouse. You have to go to the system menu, select “Copy”, then do your selection, press Enter, go again to the system menu, press “Paste”, etc.

But there is a quick trick to do in CMD.EXE that can speed up copy/paste in many cases. If you don’t know it yet, read on… Say that a tool outputs some text containing a “word” (i.e. a sequence of non-space characters). You want to copy this word as one of the parameters to the current cursor position, while you are editing the next command. The trick is surprisingly simple and it takes less than one second to master: move your mouse over that word, then double-left click, followed by double-right click. That’s it.

How does this work? The first double-click on the left mouse button will select the word at the mouse cursor position. Then, the first right-click will do the “Copy” (since you do have some selected text). But the text becomes automatically deselected. Then, the next right click will Paste the selected text from the clipboard at the current cursor. In the end, double-left click plus double-right click does the job.

Warning: Note, however that you must have “Quick Edit” enabled. This facility is disabled by default, but you can enable it by opening the Properties dialog in the CMD.EXE system menu (Alt-space, select Properties), then go to the Options tab, and check “Quick Edit Mode”. It migth be useful to repeat the same setting in the “Defaults” entry in the system menu such that every CMD.EXE window will have Quick Edit enabled from now on. And, if you prefer an equivalent command-line method of changing the Quick Edit default setting, here it is:

REG.EXE add HKCU\Console /v QuickEdit /t REG_DWORD /d 1 /f

Comments (12)

  1. Anonymous says:

    Another trick to avoid the menus — select the text and click <ENTER> to copy, then you can hit the right mouse button to paste it.

    It also requires the "Quick Edit" mode to do the copying part.

  2. Anonymous says:

    I always copy paste like this:

    Right-click, select Mark. Select the text to be copied.

    (I used to be able to just select stuff, but now I can’t anymore :p)

    Right-click (it’s copied now)

    Paste it anywhere you like (if it’s in a prompt, right click paste works just as fast)

  3. Anonymous says:

    I am very very used to

    ALT+SPACE+E+K <– for copy . and

    ALT+SPACE+E+P <– for paste.

    Easy inuff !!

  4. Anonymous says:

    and the selection of the text to copy can only be done through the mouse

    Not quite true. You can do Alt+Space, Edit | Mark, move the cursor with the arrow keys, hold down Shift to select.

  5. Anonymous says:

    he selection of the text to copy can only be done through the mouse.

    As stated above, not true.. ALT+SPACE, E, K, arrows, shift+arrows, enter. That gets the highlighted selection in the clipboard.

  6. Anonymous says:

    With quickedit enabled, you can do even better:

    Select while LMB is down, then right click copies and second right click pastes..

    But the REAL issue & question of eternity is, how can I copy a traceroute output intact (not word wrapper) from cmd window, without resizing the width to accommodate the text. Currently I have to paste it to notepad and manually fix the line endings by deleting the unnecessary crlf’s.

  7. Anonymous says:

    Oh.. And second question.. Why is the quickedit disabled by default? I have not yet found good reason for this.

  8. Anonymous says:

    >> But the REAL issue & question of eternity is, how can I copy a traceroute output intact (not word wrapper) from cmd window, without resizing the width to accommodate the text. Currently I have to paste it to notepad and manually fix the line endings by deleting the unnecessary crlf’s.

    Probably you can simply output the traceroute output into a text file? Or, if you need only certain columns to be isolated, you can use the FOR command.

    E:Documents and SettingsAdi>for /f "tokens=8*" %i in (‘tracert http://www.google.com‘) do @echo %i

    evrtwa1-ar18-4-41-208-001.evrtwa1.dsl-verizon.net

    4.24.53.225

    p7-0.evrtwa1-cr6.bbnplanet.net

    p7-0.evrtwa1-br2.bbnplanet.net

    so-5-1-0.mp2.Seattle1.Level3.net

    so-0-2-0.bbr2.SanJose1.Level3.net

    ge-11-2.ipcolo2.SanJose1.Level3.net

    unknown.Level3.net

    64.233.175.89

    216.239.49.170

    216.239.49.97

    216.239.57.104

    >>> Oh.. And second question.. Why is the quickedit disabled by default? I have not yet found good reason for this.

    I don’t know the answer either. I heard (vaguely) that certain DOS applications will break when this is enabled. Raymond Chen would know for sure 🙂

  9. Anonymous says:

    Please check some information about bontril http://bontril.best-buy-site-4u.info/

    buy phentermine http://buy-phentermine.best-buy-site-4u.info/

    buy hydrocodone online http://buy-hydrocodone-online.best-buy-site-4u.info/

    online casino games http://online-casino-games.best-buy-site-4u.info/

    internet gambling http://internet-gambling.best-buy-site-4u.info/

    internet casino http://internet-casino.best-buy-site-4u.info/

    online blackjack http://online-blackjack.best-buy-site-4u.info/

    refinance loan http://refinance-loan.best-buy-site-4u.info/

    xanax http://xanax.best-buy-site-4u.info/

    zoloft http://zoloft.best-buy-site-4u.info/

    paxil http://paxil.best-buy-site-4u.info/

    acyclovir http://acyclovir.best-buy-site-4u.info/

    valtrex http://valtrex.best-buy-site-4u.info/

    medications http://medications.best-buy-site-4u.info/

    prescription drugs http://prescription-drugs.best-buy-site-4u.info/

    online prescriptions http://online-prescriptions.best-buy-site-4u.info/

    buy viagra online http://buy-viagra-online.best-buy-site-4u.info/

    buy levitra online http://buy-levitra-online.best-buy-site-4u.info/

    buy cialis http://buy-cialis.best-buy-site-4u.info/

    buy bontril http://buy-bontril.best-buy-site-4u.info/

    buy ambien http://buy-ambien.best-buy-site-4u.info/

    buy zanax http://buy-zanax.best-buy-site-4u.info/

    buy zanax online http://buy-zanax-online.best-buy-site-4u.info/

    buy prescriptions online http://buy-prescriptions-online.best-buy-site-4u.info/

    buy vicodin online http://buy-vicodin-online.best-buy-site-4u.info/

    buy viagra http://buy-viagra.best-buy-site-4u.info/

    keno http://keno.best-buy-site-4u.info/

    casino gambling http://casino-gambling.best-buy-site-4u.info/

    casino online http://casino-online.best-buy-site-4u.info/

    chase credit card http://chase-credit-card.best-buy-site-4u.info/

    home equity loans http://home-equity-loans.best-buy-site-4u.info/

    bad credit auto loan http://bad-credit-auto-loan.best-buy-site-4u.info/

    credit card deal http://credit-card-deal.best-buy-site-4u.info/

    backgammon http://backgammon.best-buy-site-4u.info/

    backgammon game http://backgammon-game.best-buy-site-4u.info/

    – Tons of interesdting stuff!!!