Keyboard shortcut to paste clipboard content into command prompt window (Win XP)

WindowsKeyboard Shortcuts

Windows Problem Overview


Is there a keyboard shortcut for pasting the content of the clipboard into a command prompt window on Windows XP (instead of using the right mouse button)?

The typical Shift+Insert does not seem to work here.

Windows Solutions


Solution 1 - Windows

Yes.. but awkward. Link

alt + Space, e, k <-- for copy and
alt + Space, e, p <-- for paste.

Solution 2 - Windows

I personally use a little AutoHotkey script to remap certain keyboard functions, for the console window (CMD) I use:

; Redefine only when the active window is a console window 
#IfWinActive ahk_class ConsoleWindowClass

; Close Command Window with Ctrl+w
$^w::
WinGetTitle sTitle
If (InStr(sTitle, "-")=0) { 
	Send EXIT{Enter}
} else {
	Send ^w
}

return 


; Ctrl+up / Down to scroll command window back and forward
^Up::
Send {WheelUp}
return

^Down::
Send {WheelDown}
return


; Paste in command window
^V::
; Spanish menu (Editar->Pegar, I suppose English version is the same, Edit->Paste)
Send !{Space}ep
return

#IfWinActive 

Solution 3 - Windows

Not really programming related, but I found this on Google, there is not a direct keyboard shortcut, but makes it a little quicker.

To enable or disable QuickEdit mode:

  1. Open the MS-DOS program, or the command prompt.
  2. Right-click the title bar and press Properties.
  3. Select the Options tab.
  4. Check or un-check the QuickEdit Mode box.
  5. Press OK.
  6. In the Apply Properties To Shortcut dialog, select the Apply properties to current window only if you wish to change the QuickEdit setting for this session of this window only, or select Modify shortcut that started this window to change the QuickEdit setting for all future invocations of the command prompt, or MS-DOS program.

QuickEdit

To Copy text when QuickEdit is enabled:

  1. Click and drag the mouse pointer over the text you want.
  2. Press Enter (or right-click anywhere in the window) to copy the text to the clipboard.

To Paste text when QuickEdit is enabled:

  1. Right-click anywhere in the window.

To Copy text when QuickEdit is disabled:

  1. Right-click the title bar, press Edit on the menu, and press Mark.
  2. Drag the mouse over the text you want to copy.
  3. Press Enter (or right-click anywhere in the window) to copy the text to the clipboard.

To Paste text when QuickEdit is disabled:

  1. Right-click the title bar, press Edit on the menu, and press Paste.

Solution 4 - Windows

Thanks Pablo, just what I was looking for! However, if I can take the liberty of improving your script slightly, I suggest replacing your ^V macro with the following:

; Use backslash instead of backtick (yes, I am a C++ programmer).
#EscapeChar \

; Paste in command window.
^V::
StringReplace clipboard2, clipboard, \r\n, \n, All
SendInput {Raw}%clipboard2%
return

The advantage of using SendInput is that

  • it doesn't rely on the command prompt system menu having an "Alt+Space E P" menu item to do the pasting (works for English and Spanish, but not for all languages).
  • it avoids that nasty flicker you get as the menu is created and destroyed.

Note, it's important to include the "{Raw}" in the SendInput command, in case the clipboard happens to contain "!", "+", "^" or "#".

Note, it uses StringReplace to remove excess Windows carriage return characters. Thanks hugov for that suggestion!

Solution 5 - Windows

There is also a great open source tool called clink, which extends cmd by many features. One of them is being able to use ctrl+v to insert text.

Solution 6 - Windows

Solution 7 - Windows

Here's a free tool that will do it on Windows. I prefer it to a script as it's easy to set up. It runs as a fast native app, works on XP and up, has configuration settings that allow to remap copy/paste/selection keys for command windows:

enter image description here

Plus I know the developers.

Solution 8 - Windows

Thanks, Pablo, for referring to AutoHotkey utility. Since I have Launchy installed which uses Alt+Space I had to modify it a but to add Shift key as shown:

; Paste in command window
^V::
; Spanish menu (Editar->Pegar, I suppose English version is the same, Edit->Paste)
Send !+{Space}ep
return

Solution 9 - Windows

simplest method is just the copy the text that you want to paste it in cmd and open cmd goto "properties"---> "option" tab----> check the (give tick mark) "quickEdit mode" and click "ok" .....now you can paste any text from clipboard by doing right click from ur mouse.

Thank you..

Solution 10 - Windows

This is not really a shortcut but just a quick access to the control menu: Alt-space E P

If you can use your mouse, right click on the cmd window works as paste when I tried it.

Solution 11 - Windows

Theoretically, the application in DOS Prompt has its own clipboard and shortcuts. To import text from Windows clipboard is "extra". However you can use Alt-Space to open system menu of Prompt window, then press E, P to select Edit, Paste menu. However, MS could provide shortcut using Win-key. There is no chance to be used in DOS application.

Solution 12 - Windows

It took me a small while to figure out why your AutoHotkey script does not work with me:

; Use backslash instead of backtick (yes, I am a C++ programmer).
#EscapeChar \

; Paste in command window.
^V::
StringReplace clipboard2, clipboard, \r\n, \n, All
SendInput {Raw}%clipboard2%
return

In fact, it relies on keystrokes and consequently on keyboard layout! So when you are, as I am, unfortunate to have only an AZERTY keyboard, your suggestion just does not work. And worse, I found no easy way to replace SendInput method or twist its environment to fix this. For example SendInput "1" just does not send digit 1.

I had to turn every character into its unicode to make it work on my computer:

#EscapeChar \

; Paste in command window.
^V::
StringReplace clipboard2, clipboard, \r\n, \n, All
clipboard3 := ""
Loop {
    if (a_index>strlen(clipboard2))
     break 
    char_asc := Asc(SubStr(clipboard2, a_Index, 1))   
    if (char_asc > 127 and char_asc < 256)
     add_zero := "0"
    else
     add_zero := "" 
    clipboard3 :=  clipboard3  . "{Asc " .  add_zero . char_asc . "}"
}
SendInput %clipboard3%
return

Not very simple...

Solution 13 - Windows

I followed @PabloG's steps as follows

  1. goto http://www.autohotkey.com/ - download autohotkey
  2. follow simple installation steps
  3. after installation create new *.ahk file as follows right click on desktop > new > Autohotkey Script > giveAnyFileName.ahk
  4. right click on this file > Edit
  5. copy paste autohotkey script given by @PabloG in his answer
  6. save and close
  7. double click on file to run
  8. Done now you should be able to use Ctrl+v for paste in command prompt

Solution 14 - Windows

If you use the clipboard manager Ditto (open source, gratis), you can simply use the shortcut to paste from Ditto, and it will paste the clipboard in CMD for you.

enter image description here

Solution 15 - Windows

You could try using [Texter][1] and create something unlikely like:

./p , triggered by space and replacing the text with %c

I just tested it and it works fine. The only gotcha is to use a rare sequence, as Texter cannot restrict this to just cmd.

There are probably other utilities of this kind which could work, and even [AutoHotKey][2], upon which Texter is built could do it better, but Texter is easy :-)

[1]: http://lifehacker.com/software/texter/lifehacker-code-texter-windows-238306.php "Texter" [2]: http://www.autohotkey.com "AutoHotKey"

Solution 16 - Windows

A simpler way is to use windows powershell instead of cmd. itworks fine with texter.

Solution 17 - Windows

I've recently found that command prompt has support for context menu via the right mouse click. You can find more details here: http://www.askdavetaylor.com/copy_paste_within_microsoft_windows_command_prompt.html

Solution 18 - Windows

Pretty simple solution may be Console 2, redefine keys and you go.

Solution 19 - Windows

If you're a Cygwin user, you can append the following to your ~/.bashrc file:

stty lnext ^q stop undef start undef

And the following to your ~/.inputrc file:

"\C-v": paste-from-clipboard
"\C-C": copy-to-clipboard

Restart your Cygwin terminal.

(Note, I've used an uppercase C for copy, since CTRL+c is assigned to the break function on most consoles. Season to taste.)

Source

Solution 20 - Windows

Instead of "right click"....start your session (once you're in the command prompt window) by keying Alt/SpaceBar. That will open the Command Prompt window menu and you'll see your familiar, underlined keyboard command shortcuts, just like in Windows GUI.

Good luck!

Solution 21 - Windows

Under VISTA Command prompt: Click on the System Icon Select Defaults from the Menu On the Options tab in the Options group I have "Quick Edit Mode", "Insert Mode", and "Auto Complete" selected I think that "Quick Edit Mode" is what makes it work.

To paste whatever is in the Clipboard at the insertion point: Right Click. To copy from the Command Window Select by holding down the left mouse button and dragging the pointer across what you want to copy Once selected, right click To paste at the insertion point, right click again.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionsmeView Question on Stackoverflow
Solution 1 - WindowsNescioView Answer on Stackoverflow
Solution 2 - WindowsPabloGView Answer on Stackoverflow
Solution 3 - WindowsRob CooperView Answer on Stackoverflow
Solution 4 - WindowsHuw WaltersView Answer on Stackoverflow
Solution 5 - WindowssibblView Answer on Stackoverflow
Solution 6 - WindowsFranck DernoncourtView Answer on Stackoverflow
Solution 7 - Windowsc00000fdView Answer on Stackoverflow
Solution 8 - WindowsMaksym KozlenkoView Answer on Stackoverflow
Solution 9 - WindowsVignesh VRTView Answer on Stackoverflow
Solution 10 - WindowsjopView Answer on Stackoverflow
Solution 11 - Windowsi486View Answer on Stackoverflow
Solution 12 - WindowsDjeeView Answer on Stackoverflow
Solution 13 - WindowsPravin WView Answer on Stackoverflow
Solution 14 - WindowsFranck DernoncourtView Answer on Stackoverflow
Solution 15 - WindowsnjsfView Answer on Stackoverflow
Solution 16 - WindowsilcredoView Answer on Stackoverflow
Solution 17 - WindowsDenis VuykaView Answer on Stackoverflow
Solution 18 - WindowsBGBRUNOView Answer on Stackoverflow
Solution 19 - WindowsU007DView Answer on Stackoverflow
Solution 20 - WindowsMichael ScottView Answer on Stackoverflow
Solution 21 - WindowsRichardView Answer on Stackoverflow