Autohotkey 脚本打开命令提示符 [英] Autohotkey script to open command prompt
问题描述
我从 AutoHotKey
论坛收集了一个脚本,它允许我在 Windows 资源管理器中打开的位置打开命令提示符.如果当前窗口不是资源管理器窗口,则提示会在脚本所在的位置打开.如果当前窗口不是资源管理器窗口,我想更改此行为并使其从 C:
打开.我试图编辑脚本,但它没有按预期工作.
I've collected a script from the AutoHotKey
forum which lets me open a command prompt at the location I'm open in windows explorer. If the current window is not a explorer window then the prompt opens at the location where the script is present. I would like to change this behavior and make it open from C:
if the current window is not a explorer window. I've tried to edit the script but its not working as desired.
#ifwinactive, ahk_class CabinetWClass
ControlGetText, address , edit1, ahk_class CabinetWClass
if (address <> "") {
Run, cmd.exe, %address%
}
else {
Run, cmd.exe, "C:"
}
ExitApp
#ifwinactive
推荐答案
在c:路径下运行cmd.exe的命令是
The command to run cmd.exe in the c: path is
运行,cmd.exe,c:
run, cmd.exe, c:
每次运行 cmd 窗口的完整脚本如下所示
A full script that would run the cmd window every time would look like this
SetTitleMatchMode, 2
ifwinactive, ahk_class CabinetWClass
ControlGetText, address , edit1, ahk_class CabinetWClass
else
address =
; Exclude specific windows
ifwinactive, My Computer
address =
ifwinactive, My Documents
address =
if (address <> "")
Run, cmd.exe, %address%
else
Run, cmd.exe, C:
ExitApp
这篇关于Autohotkey 脚本打开命令提示符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!