I have a Windows service. I need to run it (sometimes) in debug mode. I know I can set command line parameters in Service properties. I use this code in Service:
But unfortunately the debug mode is not activated. I do some testing and write content of CommandLine(),CommandLine(1),CommandLine(2) in EventLog and I saw complete filename for service executable in cases 1 and 2, and empty value for case 3. But I didn't see option "-d" in three results. Could you please someone explain me why CommandLine returns unexpected value in ServiceMode?
IF CommandLine(2) = "-d" THEN // activate debug mode END
But unfortunately the debug mode is not activated. I do some testing and write content of CommandLine(),CommandLine(1),CommandLine(2) in EventLog and I saw complete filename for service executable in cases 1 and 2, and empty value for case 3. But I didn't see option "-d" in three results. Could you please someone explain me why CommandLine returns unexpected value in ServiceMode?