Jump to content

schtasks to run script at set time every weekday

Recommended Posts

I am attempting to run an Autoit.exe with schtasks every weekday @ 9:05 am.

I have the below

C:\>SchTasks /Create /TN "P10Run" /TR "O:\AUTOIT\P40 Run.au3" /SC WEEKLY /D MON,
TUE,WED,THU,FRI /ST 09:05:00
SUCCESS: The scheduled task "P10Run" has successfully been created.

I also did a "test" run :

C:\>Schtasks /Run /TN "P10Run
SUCCESS: Attempted to run the scheduled task "P10Run".

But when I run my query to verify success my "Last Result" seems to indicate that the script did not run:


Folder: \
HostName:                             xxxxxxxxxxxxxxxx
TaskName:                             \P10RUN
Next Run Time:                        N/A
Status:                               Could not start
Logon Mode:                           Interactive only
Last Run Time:                        6/14/2017 9:08:56 AM
Last Result:                          -2147024894
Author:                               xxxxxxx
Task To Run:                          O:\AUTOIT\P40 Run.au3
Start In:                             N/A
Comment:                              N/A
Scheduled Task State:                 Enabled
Idle Time:                            Disabled
Power Management:                     Stop On Battery Mode, No Start On Batterie
Run As User:                          xxxxxxxxx\xxxxxxxx
Delete Task If Not Rescheduled:       Enabled
Stop Task If Runs X Hours and X Mins: 72:00:00
Schedule:                             Scheduling data is not available in this f
Schedule Type:                        Weekly
Start Time:                           9:05:00 AM
Start Date:                           6/14/2017
End Date:                             N/A
Days:                                 MON, TUE, WED, THU, FRI
Months:                               Every 1 week(s)
Repeat: Every:                        Disabled
Repeat: Until: Time:                  Disabled
Repeat: Until: Duration:              Disabled
Repeat: Stop If Still Running:        Disabled


Is there something missing in my command? Also is there a better way to make sure that the script does in fact sun successfully?

Thanks In Advance! 

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • By v120
      Original posted by CoePSX
    • By ces1a
      ;This script will calculate the Nth weekday of any month. Just replace the numbers for $Year, $Month, $Week, and $Weekday with numbers of your choice,
      ;Some lines are not really needed but are there to allow testing and proofing. It is based on Excel formula.
      #include <Date.au3>
      Global $tmp, $Year = "2019", $Month = "2", $Week = 2, $WeekDay = 4
      Global $aNth = StringSplit("First  ,Second ,Third  ,Fourth ,Fifth  ", ",")
      Func GetWeekDay($Week, $Year, $Month, $WeekDay)
          Local $LastDay = 8 - $WeekDay, $EndDay = $Week * 7 + 1
          $Month = $Month > 10 ? $Month : "0" & $Month
          Local $iWday = _DateToDayOfWeek($YEAR, $Month, $LastDay)
          Return $YEAR & "/" & $Month & "/" & $EndDay - $iWday
      MsgBox(0,'',$aNth[$Week] & _DateDayOfWeek($WeekDay) & " of " & _DateToMonth($Month) & _
          " " & $Year & " is  " & GetWeekDay($Week, $Year, $Month, $WeekDay) )
    • By AnonymousX
      So I just got a new computer, and instantly went and installed Autoit onto it. I selected run script as default action when clicking on an au3 file, however every time I do this it opens the script in the editor. I can from there run the script no problem.
      I've tried reinstalling and checking the settings by hitting "Ctrl+1" and have confirmed it is set to run, but yet it just continues to open in the editor.
      Any ideas why this is happening or how to solve?
      New system is windows 10, old was windows 7
    • By ademon
      Hi. I can open the editor with out problems but I can not compile because it is placed on another partition diferent from C.
      Can you provide an update of this bug?

    • By lenclstr746
      Hi guys,
      Some functions of my script are running slowly. Very slow. What is the reason?
      My Code:
  • Create New...