windows 将剪贴板内容粘贴到命令提示符窗口的键盘快捷键 (Win XP)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/131955/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Keyboard shortcut to paste clipboard content into command prompt window (Win XP)
提问by sme
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)?
是否有用于将剪贴板的内容粘贴到 Windows XP 上的命令提示符窗口中的键盘快捷键(而不是使用鼠标右键)?
The typical Shift+Insertdoes not seem to work here.
典型的Shift+Insert在这里似乎不起作用。
采纳答案by PabloG
I personally use a little AutoHotkeyscript to remap certain keyboard functions, for the console window (CMD) I use:
我个人使用一个小的AutoHotkey脚本来重新映射某些键盘功能,对于我使用的控制台窗口 (CMD):
; 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
回答by Nescio
回答by Rob Cooper
Not really programming related, but I found thison Google, there is not a direct keyboard shortcut, but makes it a little quicker.
与编程无关,但我在谷歌上找到了这个,没有直接的键盘快捷键,但让它更快一点。
To enable or disable QuickEdit mode:
要启用或禁用快速编辑模式:
- Open the MS-DOS program, or the command prompt.
- Right-click the title bar and press Properties.
- Select the Options tab.
- Check or un-check the QuickEdit Mode box.
- Press OK.
- 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.
- 打开 MS-DOS 程序或命令提示符。
- 右键单击标题栏,然后按属性。
- 选择选项选项卡。
- 选中或取消选中“快速编辑模式”框。
- 按确定。
- 在“将属性应用到快捷方式”对话框中,如果您只想更改此窗口的此会话的 QuickEdit 设置,请选择“将属性应用到当前窗口”,或选择“修改启动此窗口的快捷方式”以更改所有未来调用的 QuickEdit 设置命令提示符或 MS-DOS 程序。
To Copy text when QuickEdit is enabled:
在启用 QuickEdit 时复制文本:
- Click and drag the mouse pointer over the text you want.
- Press Enter (or right-click anywhere in the window) to copy the text to the clipboard.
- 单击并将鼠标指针拖到所需的文本上。
- 按 Enter(或右键单击窗口中的任意位置)将文本复制到剪贴板。
To Paste text when QuickEdit is enabled:
在启用 QuickEdit 时粘贴文本:
- Right-click anywhere in the window.
- 右键单击窗口中的任意位置。
To Copy text when QuickEdit is disabled:
在禁用 QuickEdit 时复制文本:
- Right-click the title bar, press Edit on the menu, and press Mark.
- Drag the mouse over the text you want to copy.
- Press Enter (or right-click anywhere in the window) to copy the text to the clipboard.
- 右键单击标题栏,按菜单上的编辑,然后按标记。
- 将鼠标拖到要复制的文本上。
- 按 Enter(或右键单击窗口中的任意位置)将文本复制到剪贴板。
To Paste text when QuickEdit is disabled:
在禁用 QuickEdit 时粘贴文本:
- Right-click the title bar, press Edit on the menu, and press Paste.
- 右键单击标题栏,按菜单上的编辑,然后按粘贴。
回答by Huw Walters
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:
谢谢巴勃罗,正是我想要的!但是,如果我可以冒昧地稍微改进一下您的脚本,我建议将您的 ^V 宏替换为以下内容:
; 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
使用 SendInput 的好处是
- 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.
- 它不依赖于具有“Alt+Space E P”菜单项的命令提示系统菜单来进行粘贴(适用于英语和西班牙语,但不适用于所有语言)。
- 它避免了在创建和销毁菜单时出现的令人讨厌的闪烁。
Note, it's important to include the "{Raw}" in the SendInput command, in case the clipboard happens to contain "!", "+", "^" or "#".
请注意,在 SendInput 命令中包含“{Raw}”很重要,以防剪贴板碰巧包含“!”、“+”、“^”或“#”。
Note, it uses StringReplace to remove excess Windows carriage return characters. Thanks hugov for that suggestion!
请注意,它使用 StringReplace 删除多余的 Windows 回车符。感谢 Hugov 的建议!
回答by sibbl
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.
还有一个很棒的开源工具 clink,它通过许多功能扩展了 cmd。其中之一是能够使用 ctrl+v 插入文本。
回答by Franck Dernoncourt
On Windows 10, you can enable Ctrl+ Cand Ctrl+ Vto work in the command prompt:
在 Windows 10 上,您可以启用Ctrl+ C和Ctrl+ V以在命令提示符下工作:
回答by c00000fd
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:
这是一个可以在 Windows 上执行此操作的免费工具。我更喜欢它而不是脚本,因为它很容易设置。它作为一个快速的本机应用程序运行,适用于 XP 及更高版本,具有允许重新映射命令窗口的复制/粘贴/选择键的配置设置:
Plus I know the developers.
另外我认识开发人员。
回答by Vignesh VRT
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 clickfrom ur mouse.
最简单的方法是将要粘贴的文本复制到cmd并打开cmd转到“属性”--->“选项”选项卡---->选中(打勾)“快速编辑模式”并单击“好的”.....现在您可以通过从鼠标右键单击来粘贴剪贴板中的任何文本。
Thank you..
谢谢..
回答by Maksym Kozlenko
Thanks, Pablo, for referring to AutoHotkey utility. Since I have Launchy installed which uses Alt+SpaceI had to modify it a but to add Shiftkey as shown:
感谢 Pablo 提及 AutoHotkey 实用程序。由于我安装了 Launchy,它使用Alt+Space我不得不修改它 a 但添加Shift密钥,如图所示:
; Paste in command window
^V::
; Spanish menu (Editar->Pegar, I suppose English version is the same, Edit->Paste)
Send !+{Space}ep
return
回答by jop
This is not really a shortcut but just a quick access to the control menu: Alt-space E P
这不是真正的快捷方式,而只是快速访问控制菜单:Alt-space EP
If you can use your mouse, right click on the cmd window works as paste when I tried it.
如果您可以使用鼠标,则在我尝试时右键单击 cmd 窗口可用作粘贴。