为什么Task Scheduler用Notepad ++打开AutoHotKey脚本而不是实际运行它?

时间:2017-12-03 03:48:10

标签: notepad++ scheduled-tasks autohotkey

我使用任务计划程序以最高权限在登录时自动运行AutoHotKey脚本。但最近它突然切换到脚本上打开Notepad ++,而不是实际运行它。双击脚本仍然按预期工作。

发生了什么事?以及如何解决这个问题?

任务的xml导出:

<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Date>2017-08-16T17:26:03.6121892</Date>
    <Author>OOKER-LAPTOP\Ooker</Author>
    <URI>\AutoHotkey</URI>
  </RegistrationInfo>
  <Triggers>
    <LogonTrigger>
      <Enabled>true</Enabled>
    </LogonTrigger>
  </Triggers>
  <Principals>
    <Principal id="Author">
      <UserId>S-1-5-21-3621221271-3088881583-359884916-1002</UserId>
      <LogonType>InteractiveToken</LogonType>
      <RunLevel>HighestAvailable</RunLevel>
    </Principal>
  </Principals>
  <Settings>
    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
    <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
    <AllowHardTerminate>true</AllowHardTerminate>
    <StartWhenAvailable>true</StartWhenAvailable>
    <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
    <IdleSettings>
      <StopOnIdleEnd>true</StopOnIdleEnd>
      <RestartOnIdle>false</RestartOnIdle>
    </IdleSettings>
    <AllowStartOnDemand>true</AllowStartOnDemand>
    <Enabled>true</Enabled>
    <Hidden>false</Hidden>
    <RunOnlyIfIdle>false</RunOnlyIfIdle>
    <WakeToRun>false</WakeToRun>
    <ExecutionTimeLimit>PT72H</ExecutionTimeLimit>
    <Priority>7</Priority>
  </Settings>
  <Actions Context="Author">
    <Exec>
      <Command>D:\Data\Config\Essential.ahk</Command>
    </Exec>
  </Actions>
</Task>

HKEY_CLASSES_ROOT\AutoHotkeyScript导出的注册表:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\AutoHotkeyScript]
@="AutoHotkey Script"

[HKEY_CLASSES_ROOT\AutoHotkeyScript\DefaultIcon]
@="C:\\Program Files\\AutoHotkey\\AutoHotkey.exe,1"

[HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell]
@="Open"

[HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Compile]
@="Compile Script"

[HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Compile\Command]
@="\"C:\\Program Files\\AutoHotkey\\Compiler\\Ahk2Exe.exe\" /in \"%l\""

[HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Edit]

[HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Edit\Command]
@="C:\\Program Files (x86)\\Notepad++\\notepad++.exe %1"

[HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Open]
@="Run Script"

[HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Open\Command]
@="\"C:\\Program Files\\AutoHotkey\\AutoHotkey.exe\" \"%1\" %*"

[HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\RunAs]

[HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\RunAs\Command]
@="\"C:\\Program Files\\AutoHotkey\\AutoHotkey.exe\" \"%1\" %*"

[HKEY_CLASSES_ROOT\AutoHotkeyScript\ShellEx]

1 个答案:

答案 0 :(得分:1)

我不知道问题是什么,但您可以通过直接使用AutoHotkey程序启动脚本来解决问题:

app/test/vehicle/