john doe

john doe

  • NA
  • 2
  • 0

schtasks.exe and Process.Start missing Quotes

Feb 16 2009 12:13 PM
Hi,   I am trying to add a custom action in my setup project to create a scheduled task during install.  Everything is working except that the task that when it makes the scheduled task, the Run Texbox doesn't have quotes around the executable, so it fails.  I've been trying to figure out how to add the quotes in the process.start command in the c# installer class.. here's what I am running right now...

                string strProcess = Properties.Settings.Default.Process;
                string strOptions = "/create /tn HealthEquityEmail /tr \"C:\\Program Files\\Prog Dir\\ProgramTest.exe\" /sc weekly /d FRI /st 21:00:00 /ru testdomain\\xxxxxxx /rp xxxxxxxx";
               
                System.Diagnostics.Process.Start("C:\\windows\\system32\\schtasks.exe",strOptims);

I xx'd out the userid\password.. but other than that this does create the scheduled task.. if I can figure out how to get it to include quotes around the executable that would be good.. I am planning to add the part of the options as a setting in mySettings so that I can piece together the command and allow it to be changed from the config file..

I saw some stuff about the quotes for literal and non-literal strings but I couldn't get the stuff to work..

any suggestions on the quotes..

Answers (1)