【问题标题】:Why can't "Pause::Run notepad++ non_system_file" work?为什么“Pause::Run notepad++ non_system_file”不能工作?
【发布时间】:2017-11-09 18:20:08
【问题描述】:

如何正确运行这个命令?

Pause::Run notepad++ D:\Data\Config\Essential.ahk

我收到此错误:

Error: Failed attempt to launch program or document:
Action: <notepad++ D:\Data\Config\Essential.ahk>
Params: <>

Specifically: The system cannot find the file specified.

对任何键使用 Notepad++,或使用记事本的 Pause 键不起作用。这不涉及系统目录,如相关问题 (Why does AutoHotkey respond with a "System cannot find the file" error?) 中所述。你有什么想法吗?

完全错误:

【问题讨论】:

    标签: notepad++ autohotkey notepad


    【解决方案1】:

    您的路径中有“notepad++.exe”吗?

    尝试指定 notepad++.exe 的完整路径,看看是否能解决问题:

    Pause::run "C:\Program Files (x86)\Notepad++\notepad++.exe" D:\Data\Config\Essential.ahk
    

    注意事项:

    • 确保notepad++.exe安装在上述目录中
    • 您可以通过打开命令提示符并运行cd \ &amp;&amp; dir notepad.exe /s 来找到notepad++.exe
    • 使用命令提示符输入set path,查看notepad++.exe的目录是否在你的路径中

    【讨论】:

      【解决方案2】:

      AHK 无法知道“notepad++”是一个程序,如果你不使用.exe 扩展名,则会出现错误消息“系统找不到指定的文件”。

      也试试

      Pause::Run notepad++.exe D:\Data\Config\Essential.ahk
      

      Pause::Run notepad++.exe "D:\Data\Config\Essential.ahk" ; more accurate syntax
      

      【讨论】:

      • 为什么这对运行对话框有效?使用 Run explorer /path 按预期工作
      • 这个答案不正确。即使省略了EXE 扩展名,以下也可以毫无问题地启动可执行文件“notepad++.exe”:F2::run "C:\Program Files (x86)\Notepad++\notepad++" c:\windows\system32\drivers\etc\hosts
      • 我认为,在这种情况下,AHK 发现“notepad++”是一个程序,因为(= 搜索后)文件夹路径定义和文件本身的名称,如手册中所述(Run_Parameters_Target)。
      猜你喜欢
      • 2021-12-04
      • 2018-04-29
      • 1970-01-01
      • 2022-12-17
      • 2011-07-27
      • 1970-01-01
      • 2020-12-05
      • 2022-08-07
      • 1970-01-01
      相关资源
      最近更新 更多