title: C# service onCustomCommand with parameters?
body: <p>I am currently trying to implement a service that runs a special command that does something with arguments passed, for example: file paths. I am using the <code>cmd</code> command:</p>
  
  <p><code>sc control "ServiceName" 128</code></p>
  
  <p>However, this command doesn't provide any way for me to input arguments. The method is as below:</p>
  
  <pre><code>    protected override void OnCustomCommand(int command)
      {
          switch(command)
          {
              case 128:
                  Command.StartProcess(3);
                  LogWriter.WriteLog("Next output: ");
                  Command.StartProcess(4);
                  break;
              case 129:
                  // input extension, output extension, key id , working path
                  try
                  {
                      test t1 = new test();
                      t1.readLog(@"C:\Users\Joe\Desktop\success.txt");
                      LogWriter.WriteLog(t1.input);
                      LogWriter.WriteLog(t1.output);
                  }
                  catch(Exception e)
                  {
                      LogWriter.WriteLog(e.ToString());
                  }
                  finally { LogWriter.WriteLog("abc"); }
                  //LogWriter.WriteLog(t1.output + "def");
                  break;
          }
      }
  </code></pre>
  
  <p>The only argument i can input is the <code>int</code> <code>command</code> for the method. I would like to input a <code>folder path</code> for <code>t1.readLog();</code>. In the above code, I have to hard code the path which isn't flexible and troublesome. So, is there anyway to work this out?</p>