To configure an application to start as a Windows service automatically, you can follow these steps:
- Open the Command Prompt as an administrator.
- Navigate to the directory where the executable file of the application is located.
- Run the following command:
luaCopy codesc create ServiceName binPath= "C:\Path\To\Executable.exe"
Replace “ServiceName” with the name you want to give to the service and “C:\Path\To\Executable.exe” with the path to the executable file of your application.
- Once the service is created, you can start it with the following command:
sqlCopy codesc start ServiceName
Replace “ServiceName” with the name you gave to the service.
- To ensure that the service starts automatically when the computer starts, you can run the following command:
arduinoCopy codesc config ServiceName start= auto
This sets the startup type of the service to automatic.
Note: If you want to delete the service, you can run the following command:
arduinoCopy codesc delete ServiceName
Replace “ServiceName” with the name of the service you want to delete.
Or
Control whether an app can run in the background
- Select Start , then select Settings > Apps > Apps & features.
- Scroll to the desired app, select More options on the right edge of the window, then select Advanced options.
- In the Background apps permissions section, under Let this app run in the background, select one of the following options:
- Always—The app runs in the background, receiving info, sending notifications, and staying up-to-date even when you’re not actively using it. This option may use more power.
- Power optimized—Windows decides what will save the most power while still allowing the app to receive notifications and update periodically. This option may limit an app that uses a lot of power.