Quantcast
Channel: Task Scheduler Managed Wrapper
Viewing all articles
Browse latest Browse all 2206

New Post: Unable to invoke task.Run

$
0
0
Here is some working code that does what I think you're asking. You can pass string typed variables to the Run method.
Using ts As New TaskService()
    ' Create a new task definition
    Dim td As TaskDefinition = ts.NewTask

    ' Add a daily trigger
    Dim dt As New DailyTrigger()
    dt.StartBoundary = dtStartDate
    td.Triggers.Add(dt)

    ' Add an action that takes parameters
    td.Actions.Add(New ExecAction("myprogram.exe", "$(Arg0)", "$(Arg1)", "$(Arg2)"))

    ' Register the task in the root folder
    Dim task As Task = ts.RootFolder.RegisterTaskDefinition("Test", td)

    ' Run the task immediately with parameters
    task.Run("A", var1, "C")
End Using

Viewing all articles
Browse latest Browse all 2206

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>