Here I have create service for writing .txt file and passing parameter from Task scheduler using this code :
static void Main(string[] args)
{
string abc = string.Empty;
foreach (var item in args)
{
abc += item +" ";
}
string path = @"D:\GST Project\Demo Text File.txt";
File.WriteAllText(path, abc);
}
I have added the task in task scheduler like this:
I want to call my scheduler task by using C# code below is my code which I have taken from Link
using (TaskService tasksrvc = new TaskService(server.Name, login, domain, password))
{
Task task = tasksrvc.FindTask(taskName);
task.Run();
}
I am wondering here how we can pass the parameter through TaskService. Also What should I pass in place of Server.Name,login, domain,Password. Thanks for your help !