Akshay J
Akshay J

Reputation: 5458

Run an exe when machine starts

I have created an SMS application in .NET.
I wanted that the application should run when the computer starts, even before the user logs in.

Just like the SQL Server.

Upvotes: 1

Views: 420

Answers (5)

gimel
gimel

Reputation: 86344

Wrap your application in a Windows Service, using the .NET System.ServiceProcess namespace.

The System.ServiceProcess namespace provides classes that allow you to implement, install, and control Windows service applications. Services are long-running executables that run without a user interface. Implementing a service involves inheriting from the ServiceBase class and defining specific behavior to process when start, stop, pause, and continue commands are passed in, as well as custom behavior and actions to take when the system shuts down.

Upvotes: 1

honzas
honzas

Reputation: 1831

Use ServiceEx to make a service from your executable: http://serviceex.com/ , just write one INI file, you can choose if application's window is hidden or showed etc.

Upvotes: 0

Rob van Groenewoud
Rob van Groenewoud

Reputation: 1874

You could consider making it a Windows Service.

Upvotes: 3

Hans Passant
Hans Passant

Reputation: 941317

You'll have to write a service. Start here...

Upvotes: 2

ChrisF
ChrisF

Reputation: 137128

You need to create your application as a Windows Service. The linked MSDN page will provide full details.

Microsoft Windows services, formerly known as NT services, enable you to create long-running executable applications that run in their own Windows sessions. These services can be automatically started when the computer boots, can be paused and restarted, and do not show any user interface. These features make services ideal for use on a server or whenever you need long-running functionality that does not interfere with other users who are working on the same computer. You can also run services in the security context of a specific user account that is different from the logged-on user or the default computer account. For more information about services and Windows sessions, see the About Services section in the Platform SDK documentation in the MSDN Library.

Upvotes: 3

Related Questions