Answers:
试试这个代替:
^BackSpace:: ;;Delete previous word
Send ^+{Left}
Loop, 500 {
Send {Del}
}
Return
它通过在前一个单词定位后发送500个删除来修改前一个答案。500可能太高了,但那又如何呢?
这是用于autohotkey(http://www.autohotkey.com/)的,并且在cmd窗口中工作,我将其放在cmd窗口特定部分中,粘贴代码如下:
#IfWinActive ahk_class ConsoleWindowClass
; Paste in command window
^V::
Send !{Space}ep
return
^BackSpace:: ;;Delete previous word
Send ^+{Left}
Loop, 500 {
Send {Del}
}
Return
#IfWinActive
想要这个很久了!:)只是想+1使用AHK的想法,并建议对其脚本进行改进。我喜欢^ W来擦除单词,就像在Linux shell中一样,所以我很高兴找到了这个。
第一个脚本在CMD中对我不起作用(跳回一个单词,然后擦除第一个字符,而不是整个单词)。上面的下一个脚本也不是很理想,因此不是循环播放例如500次发送Del击键(我发现有时会溢出并在其他窗口中将删除发送到另一个窗口,请注意),而是使用CMD的F4功能:提示并删除最多该字符。因此,用ctrl-Left跳回一个单词,然后按F4,然后按Space,最多删除一个空格。唯一的次要缺点是(a)短暂闪烁提示框,并且(b)重复的单词擦除操作会留下一堆空格(无害,但没有吸引力)。我还想要^ U(删除行的开头)和^ A / ^ E / ^ F / ^ B单词/字符移动,例如linux shell(即使它们已经存在于CMD中,我触摸打字,所以不希望将手从主键盘上移开)。:)我还保存了大卫·霍普(David Hoppe)伟大的^ V进行粘贴。
从而:
#IfWinActive ahk_class ConsoleWindowClass
; Paste in command window
^V::
Send !{Space}ep
return
; was ^BackSpace, I prefer ^W a la linux
^W:: ;;Delete previous word
Send ^+{Left}
Send {F4}{Space}
Return
^U:: ;;erase to start of line
Send ^{Home}
Return
^A:: ;;move to start of line
Send {Home}
Return
^E:: ;;move to end of line
Send {End}
Return
^F:: ;; move one char forward
Send {Right}
Return
^B:: ;;move one char back
Send {Left}
Return
#IfWinActive
Windows命令提示符中本机不可能。