Scheduled Task or Not?

  • Thread starter Thread starter Peter D. Dunlap
  • Start date Start date
P

Peter D. Dunlap

I've got a program (C#) that, if run as a scheduled task, should log
its information in the event log and otherwise run quietly, but if run
manually I want it to display progress and error information on the
screen.

Is there a way for a .NET program to determine whether it was run as a
scheduled task or manually, apart from adding a command line
parameter?

Pete Dunlap
 
I've got a program (C#) that, if run as a scheduled task, should log
its information in the event log and otherwise run quietly, but if run
manually I want it to display progress and error information on the
screen.

Is there a way for a .NET program to determine whether it was run as a
scheduled task or manually, apart from adding a command line
parameter?

Pete Dunlap

Probably the easiest way is to use a command line switch. When you set the
app to run as a scheduled task, set a command line parameter such as /a to
indicate automatic mode.

Then in the code, if the command line switch is specified, run quietly,
otherwise display on the screen.
 
Back
Top