Passing parameter to a windows service in c#
<p>I am creating a windows service which has to run on specific days and time. I am passing these variables using an XML document. Here is my code for passing the values</p>

<pre><code>   static void Main()
    {
        ServiceBase[] ServicesToRun;

        Service1= new Service1();          

        //Load setting from xml and assign to variables "daysToExec" and "timeToExec"
        LoadSettings();
        Service1.daysToExecute = daysToExec;
        Service1.timeToExecute = timeToExec;
        ServicesToRun = new ServiceBase[] { Service1 };
        ServiceBase.Run(ServicesToRun);          

    }
</code></pre>

<p>The code for OnStart() in Service1.cs </p>

<pre><code>    protected override void OnStart(string[] args)
    {
     timer1.Enable = true;
    }

    private void timer1_Tick(object sender, EventArgs e)
    {
        foreach (string DayToRun in daysToExecute)
        {
            if (DateTime.Now.DayOfWeek.ToString().ToUpper().Equals(DayToRun.ToUpper())  &amp;&amp; DateTime.Now.ToShortTimeString().Equals(timeToExecute)) 
            {
                Process.Start("Path to executable");
            }
        }
    }
</code></pre>

<p>But this is not starting the executable. Is there something wrong with this code.</p>

<p>Thanks.</p>
