service which is set as auto is not started when system restarts

Solution 1:

You can't run just any exe or bat as a service, because a system service is specifically written to interface with Windows via a special protocol, which is used by the sc command.

Services are generally written as console applications with the entry point for a console application as the main function, started by its Service Entry Point and continuing with the ServiceMain Function.

You may however encapsulate a program or batch file using a program that does implement the required protocol.

You may use:

  • NSSM - the Non-Sucking Service Manager (free and open-source)
    Last update from 2017.
  • AlwaysUp (commercial)
  • Many other alternatives.

Solution 2:

Windows Services usually require some additional configuration rather than one command line as far as I know.

If you try to open Services by services.msc and start the service just created manually, the following message should appear:

Windows could not start the service on Local Computer.

Error 1053: The service did not respond to the start or control request in a timely fashion.

If you only need to run a certain script each time Windows starts (for the current user), you can copy the .bat file and paste its shortcut into "%AppData%\Microsoft\Windows\Start Menu\Programs\Startup". Another approach to accessing it is to type shell:startup in the Explorer address bar.

Next time the current user logins in, the script will be run automatically. You can check it's added and enabled via Task Manager -> Startup.