How to paste to cmd.exe without a mouse? [duplicate]

Possible Duplicate:
How do I paste into the Windows CMD prompt by using only the keyboard?

The usual way to paste text in a cmd.exe shell is to right-click. How can you paste text using only the keyboard?


Solution 1:

ALT+Space E P :

ALT+Space for System Menu
E for Edit sub-menu
P for Paste item

Solution 2:

#IfWinActive, ahk_class ConsoleWindowClass
^v:: ;Paste in console
send !{Space}EP
return
#ifWinActive

in AutoHotKey, allowing you to Control+V to paste :)

With AutoIt you can also fix the ALT-F4 on your command prompt. Combined the script will be:

#Include <HotKey.au3>
#Include <vkConstants.au3>
; Assign "CTRL-V" to PasteDos()
_HotKeyAssign(BitOR($CK_CONTROL, $VK_V), 'PasteDos', -1, "[CLASS:ConsoleWindowClass]")
; Assign "ALT-F4" to ExitDoc()
_HotKeyAssign(BitOR($CK_ALT, $VK_F4), 'ExitDos', -1, "[CLASS:ConsoleWindowClass]")

; Make sure we don't exit
While 1
    Sleep(10)
WEnd
Func PasteDos()
   Send(ClipGet ( ))
EndFunc

Func ExitDos()
   WinClose("[ACTIVE]", "")
EndFunc

To get this running install AutoIt, add the Hotkey include, save the above script with au3 extension and run it.

Enjoy.

Solution 3:

You can read more about it here. The short (but unpleasant answer) is:

ALT + SPACE + E + K <-- for copy and
ALT + SPACE + E + P <-- for paste.

Solution 4:

In addition to these answers, it might be noted that in cmd.exe you have to enable quick-edit mode in order for alt+space, p to work. Quick-edit mode can be enabled by clicking on the top left corner in cmd.exe, then selecting properties, then going to the options tab.