How to run a .NET application in scheduled tasks when I have not logged in

I have a C # console application that just processes data. The problem is that when you exit the system, the console application ends. If I plan to launch the application at a set time, and I have not logged in, the application does not start at all. I can run it interactively by double-clicking exe, and I can open the scheduled tasks and run it by right-clicking and selecting run. As soon as I log out, the application will end. Any help would be greatly appreciated.

+4
source share
5 answers

For XP / Windows Server 2003, open the scheduled task and make sure that the "Run only at login" checkbox is cleared.

In Windows 2008, select the option "Run whether the user was enabled or not."

+7
source

Configure the application to run using the Windows Task Scheduler . This allows you to run the application regardless of whether the user is logged in.

+5
source

Create a Windows service that runs under a system account

+2
source

If I have a multi-year task that still works when I need to leave, I just lock the screen using Windows-L and leave myself logged in. If this works, it is a much simpler solution than setting up a scheduled task each time you want to start a specific task, especially if you need to specify different parameters each time.

I understand that this may not always be possible - you may have corporate rules that prohibit this or may use a shared computer where the next person needs access to the console (although completing a scheduled task in the background certainly doesn’t make them more happy), but I propose this as a simple solution for most single-user computer scripts. IMO, scheduled tasks are best used only for scheduled tasks, i.e. What you want to automate to run on a regular basis. If this describes your scenario, be sure to use it. Similarly, if you really have a service that works constantly and answers requests, use the Windows service. If you just want your work to continue to work and protect your computer until it shuts down, then locking your computer is the best way to go usually.

+1
source

I have a very similar situation. Try setting the "start at" option on the "Action" tab ("Task Properties"). Of course, you must enter the path to Directiory where you have your application.

0
source

Source: https://habr.com/ru/post/1306148/


All Articles