Answer the question
In order to leave comments, you need to log in
How to implement a program that starts automatically right after Windows 10 finishes loading?
Hello.
There is some program written on C# .NET (some console application).
I need this program to automatically run for execution immediately after loading Windows 10 (so that I don’t even notice how the program is being executed).
After execution, the program should terminate its work.
That is, it is necessary that the program be executed only once after loading the Operating System. And so every time it would be repeated when you start Windows.
How can this be done in C# .NET ?
Answer the question
In order to leave comments, you need to log in
Scheduler is a good option. Or hide the console
using System.Runtime.InteropServices
class CommandLine
{
[DllImport("user32.dll")]
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
[DllImport("Kernel32")]
private static extern IntPtr GetConsoleWindow();
const int SW_HIDE=0;
const int SW_SHOW=5;
static void Main(string[] args)
{
IntPtr hwnd;
hwnd=GetConsoleWindow();
ShowWindow(hwnd,SW_HIDE);
//Your logic goes here
}
}
The best option is to use Windows Service. For .net C# there is a wonderful Topshelf library .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question