views:

10271

answers:

11

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.

+14  A: 

Yes.. but awkward. Link

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

Nescio
Not exactly what I hoped for, but of course it works.Some additional tips: If you've mapped ALT+SPACE to your application launcher (e.g. Launchy) use ALT-SHIFT-SPACE insteadIf you're using a non-englisch version of windows the last 2 keys will of course differ (e.g. B+E for paste in german)
sme
Just to explain selecting also: ALT+SPACE+E+K <-- for copy . andnavigate up , down , left , right with arrows Shift + right arrow <-- for selecting the textALT+SPACE+E+P <-- for paste.
YordanGeorgiev
A: 

No, there's no keyboard shortcut for pasting.

Franci Penov
A: 

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.

jop
Yes, right click works fine but that's what I'm trying to avoid.
sme
+6  A: 

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.

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.
Rob Cooper
A: 

You could try using Texter 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, upon which Texter is built could do it better, but Texter is easy :-)

njsf
+17  A: 

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
PabloG
Nice...wish I'd known about this ages ago. +1
Kev
This stuff interferes with Cygwin when it is running inside a ConsoleWindow. I was excited about this tip but unfortunately I had to uninstall it.
piyo
@piyo: maybe you can exclude the Cygwin console by its titlebar?eg: if the console title bar says "ConsoleWindow" you can add something likeWinGetTitle sTitle\nIf (sTitle="ConsoleWindow") {\n return\n}\n---
PabloG
@PabloG: Good idea. (+1) Yeah that would work if the window titles are unchanging. I feel like I have more control over the window title in Cygwin so perhaps I can add some static yet invisible hinting text for AHK's filtering.
piyo
+2  A: 

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 (i) 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) and (ii) 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!

Huw Walters
@Huw: good one, improvements are always welcome!
PabloG
A: 

Thank you Nescio. I tutor a visually impaired student and we couldn't figure out the keyboard shortcut to paste text.

rahmancb4
A: 

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
Maksym Kozlenko
A: 

@Huw Thanks for the suggestion, I had just implemented some of these terminal shortcuts after having CTRL+L != cls

Here's how I did it: http://josetrigueros.com/blog/?p=8

Also used AutoHotkey

trigoman
A: 

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

ilcredo