我刚刚看到这个问题,无法帮助在 Windows XP 上发布我的 cmd 的 AutoHotkey 脚本。您可以在脚本中发现热键。好消息是当你当前的窗口是资源管理器时,cmd 会在地址栏中显示的路径中打开。
我将此脚本保存在一个文件夹中,其中存储了所有绿色工具(包括 AutoHotkey)。对于一台新机器,我只需复制文件夹,双击脚本以将 .ahk 与 AutoHotkey 关联并在我的启动文件夹中创建一个快捷方式。比安装PowerToys更快。
; Get working folder
GetWorkingFolder() {
if WinActive("ahk_class ExploreWClass") or WinActive("ahk_class CabinetWClass") {
ControlGetText, path, Edit1
return %path%
} else if WinActive("FreeCommander") {
Send, {CTRLDOWN}{ALTDOWN}{INS}{ALTUP}{CTRLUP}
Sleep, 100
return clipboard
} else {
return "C:\"
}
}
#IfWinActive,
#c::
path := GetWorkingFolder()
Run, %ComSpec%, %path%
return
; PowerShell
#+C::
path := GetWorkingFolder()
Run, %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe, %path%
return
#^c::
Run, %ComSpec%, %temp%
return
#!c::
path := GetWorkingFolder()
Run, %comspec% /k "%VS90COMNTOOLS%vsvars32.bat", %path%
return
; irb
#!b::
path := GetWorkingFolder()
Run, c:\cygwin\bin\ruby /usr/bin/irb, %path%
return
; Bash
#b::
path := GetWorkingFolder()
Run, bash --login, %path%
return
; Paste in console
+INS::
if WinActive("ahk_class ConsoleWindowClass") {
WinGetPos, x, y, w, h, A
MouseGetPos, mx, my
;MsgBox x=%x% y=%y% w=%w% h=%h% mx=%mx% my=%my%
if (mx < 10)
mx = 10
else if (mx > w - 30)
mx := w - 30
if (my < 40)
my = 40
else if (my > h)
my := h - 10
MouseClick, right, mx, my
}
return
有兴趣的朋友可以在rwin on github找到这个脚本