How To Create Service On Windows

Windows is really amazing OS, you have cool GUI, full, optimize performance especially for personal PC, it has lot of capabilities that any other OS can't compete with windows. And if you are programmer, windows also support you by providing easiness of program development, like for example when we have a program need to have a service whenever every user log on to their computer. You can create a (.bat) file to be executed when user doing installation.

To create service for experiment purpose, you can run cmd using administration privileges

sc create MyServiceName binpath= "\"C:Program Files (x86)\My Service\yourProgram.exe\" --someparameter=0" displayname= "My Service"

The trick is, always create space after equals sign, and always create double-quotes in your program location. You can add more option, like for the example above we define displayname which will appear as our service name, You can also read more detail about SC command here from official windows documentation.

If succeeded, on cmd you will see a text saying "[SC] createservice success". To even make sure that your service is created, you can check windows services, just search Services.


Popular posts from this blog

ERROR 1348 Column Password Is Not Updatable When Updating MySQL Root Password

How To Create Spring Boot Project Using Netbeans

Spring Kafka - How to use ReplyingKafkaTemplate send and reply synchronously