Let's assume that I have a C# .NET 2.0+ application running on windows. And at some certain point in time it forces Windows to restart. How can I automatically start this application again after windows restarts to continue program to do some work?? I need to do it in code somehow, but I don't know how. Point me, please to some info on this or some pieces of code will be great. Thanks!
There are several options.
1 Register it as a windows service.
2 Put a link in startup section of Start Button
3 Create an entry in registry (HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run)
The best one is the first one, as this is the recommended method to automatically start applications. You will benefit from:
But your application will require some changes and has to be a console app.. Check this link to make yourself an idea. If you have a winforms app go for options 2 or 3 (3 is better)