-1

For the past couple of days, I have been trying to code a simple script in VB for Windows 7/10, to create a scheduled task in Task Scheduler.

The only working code I can find is this one: https://msdn.microsoft.com/en-us/library/windows/desktop/aa446862(v=vs.85).aspx

My only issue is I need the task to run at "Startup" that code works on a timer.

user692942
  • 16,398
  • 7
  • 76
  • 175
Bac0n
  • 29
  • 2
  • 7
  • 1
    Possible duplicate of [VBScript for creating a scheduled task](http://stackoverflow.com/questions/31549393/vbscript-for-creating-a-scheduled-task) – user692942 Apr 21 '17 at 13:31

1 Answers1

0

Remove

const TriggerTypeDaily = 2

Add (read here)

const TriggerTypeBoot = 8

Change

Set trigger = triggers.Create(TriggerTypeDaily)

into

Set trigger = triggers.Create(TriggerTypeBoot)

and adapt/remove the rest of the code depending on your needs.

user692942
  • 16,398
  • 7
  • 76
  • 175
MC ND
  • 69,615
  • 8
  • 84
  • 126