A
A
Alexey Smirnov2016-12-20 21:48:05
Programming
Alexey Smirnov, 2016-12-20 21:48:05

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

4 answer(s)
V
Vyacheslav Zolotov, 2016-12-20
@SZolotov

look towards windows service

D
Dmitry Gavrilenko, 2016-12-20
@Maddox

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
    }
}

and put it in the autorun folder.
Or make a WCF application. And a skill and GUI wrapper if you want.

M
Maxim Grekhov, 2016-12-29
@Sterk

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 question

Ask a Question

731 491 924 answers to any question