1

У меня есть две задачи test1 и test2 . test1 для запуска системы и test2 для входа в систему.

Все работает нормально, пока не произойдет перезагрузка машины. Когда происходит перезагрузка, и я не авторизируюсь, никакая задача не выполняется. Есть ли способ решить эту проблему?

Test1:

Local $taskName = 'test1'
_TaskExists($taskName)
If @error = 0 Then
    _trace("Task " & $taskName & " exists: updating...")
    RunWait("schtasks /DELETE /F /TN " & $taskName, $WORKING_DIR, @SW_HIDE)
    RunWait("schtasks /CREATE /F /TN " & $taskName & " /TR " & '"' & @ScriptFullPath & '"' & " /SC ONSTART /RL HIGHEST ", $WORKING_DIR, @SW_HIDE)
Else
    _trace("Task " & $taskName & " does not exist: creating...")
    RunWait("schtasks /CREATE /F /TN " & $taskName & " /TR " & '"' & @ScriptFullPath & '"' & " /SC ONSTART /RL HIGHEST ", $WORKING_DIR, @SW_HIDE)
    If @error Then
        _error("Task " & $taskName & " was not created successfully: " & @error)
    EndIf
EndIf

Test2:

Local $taskName = 'test2'
_TaskExists($taskName)
If @error = 0 Then
    _trace("Task " & $taskName & " exists: updating...")
    RunWait("schtasks /DELETE /F /TN " & $taskName, $WORKING_DIR, @SW_HIDE)
    RunWait("schtasks /CREATE /F /TN " & $taskName & " /TR " & '"' & @ScriptFullPath & '"' & " /SC ONLOGON /RL HIGHEST", $WORKING_DIR, @SW_HIDE)
    If @error Then
        _error("Task " & $taskName & " was not updated successfully: " & @error)
    EndIf
Else
    _trace("Task " & $taskName & " does not exist: creating...")
    RunWait("schtasks /CREATE /F /TN " & $taskName & " /TR " & '"' & @ScriptFullPath & '"' & " /SC ONLOGON /RL HIGHEST", $WORKING_DIR, @SW_HIDE)
    If @error Then
        _error("Task " & $taskName & " was not created successfully: " & @error)
    EndIf
EndIf

0