Re: Scheduled Task or Not? by Chris
Chris
Fri Oct 31 16:31:26 CST 2003
On Sun, 26 Oct 2003 08:55:36 -0500, Peter D. Dunlap wrote:
> 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.
--
Chris
To send me an E-mail, remove the underscores and lunchmeat from my E-Mail
address.