D
David Gerler
I have a method that I wrote to create a task using
System.Diagnostics.Process and schtasks.
I am able to create the task and it runs fine until I add an arguement for
the task command. i.e. C:\program files\autoupdate.exe CHECK
Here is my method:
private static void scheduleAutoUpdate(string mode, string time)
{
Process schedule = new Process();
schedule.StartInfo.FileName = "schtasks";
schedule.StartInfo.Arguments = "/create /tn \"AutoUpdate " +
mode + "\" /ru System"
+ " /tr \"\"\"\"C:\\program
files\\GIS\\autoupdate\\autoupdate.exe\"\"\"\" /sc daily /st " + time + ":00";
schedule.Start();
}
As you see, I have included four sets of escaped dbl quotes to handle the
space in the path. However if I add "CHECK" as an agrument, it doesn't create
the task. I have tried:
\"\"\"\"C:\\program files\\GIS\\autoupdate\\autoupdate.exe\"\"\"\" CHECK
\"\"\"\"C:\\program files\\GIS\\autoupdate\\autoupdate.exe\"\" CHECK\"\"
\"\"\"\"\"\"C:\\program files\\GIS\\autoupdate\\autoupdate.exe\"\"\"\"
CHECK\"\"
Can anyone tell me what I need to do?
System.Diagnostics.Process and schtasks.
I am able to create the task and it runs fine until I add an arguement for
the task command. i.e. C:\program files\autoupdate.exe CHECK
Here is my method:
private static void scheduleAutoUpdate(string mode, string time)
{
Process schedule = new Process();
schedule.StartInfo.FileName = "schtasks";
schedule.StartInfo.Arguments = "/create /tn \"AutoUpdate " +
mode + "\" /ru System"
+ " /tr \"\"\"\"C:\\program
files\\GIS\\autoupdate\\autoupdate.exe\"\"\"\" /sc daily /st " + time + ":00";
schedule.Start();
}
As you see, I have included four sets of escaped dbl quotes to handle the
space in the path. However if I add "CHECK" as an agrument, it doesn't create
the task. I have tried:
\"\"\"\"C:\\program files\\GIS\\autoupdate\\autoupdate.exe\"\"\"\" CHECK
\"\"\"\"C:\\program files\\GIS\\autoupdate\\autoupdate.exe\"\" CHECK\"\"
\"\"\"\"\"\"C:\\program files\\GIS\\autoupdate\\autoupdate.exe\"\"\"\"
CHECK\"\"
Can anyone tell me what I need to do?