System hacks: hidden and safe to run programs as a service

Many system services in Windows 10 run in the background, which makes them both invisible and automatic before each user logs in. If we want to achieve a similar effect for our own programs, for example, if we want to use Nginx as an email proxy server for our company website, we need to start it as a service for ease of use, which can be done with the help of Srvstart (https://github.com/rozanski/srvstart).

Tip.

Since system services do not support interactive interfaces when running in the background, they are not suitable for programs like QQ and WeChat, which otherwise just run in the background without being able to view messages.

Srvstart is green software, after downloading, unzip all 4 files to your desktop first, then copy all the files to “C:Windows” (Figure 1).

2020A-YCYX-(1)

Start Notepad, enter the code in the following format, and save it as a “1.ini” file in D: for later use (where Nginx is the service name and “startup=” is followed by the full path to the program you want to start).

[Nginx]

startup=”D:nginxnginx.exe”

Next, start the command prompt as administrator and type “SC CREATE Nginx Displayname= “Nginx” binpath= “srvstart.exe Nginx -c D:1.ini” start= auto”, and the screen will prompt “[SC] CreateService Success”, indicating that the service was successfully installed (Figure 2).

2020A-YCYX-(2)

Code explanation.

CREATE Nginx and Displayname= “Nginx” means that both the service name and display name are created as Nginx, and “binpath=” is followed by the srvstart.exe program to install the service and set the service to start automatically. Note here that each “=” should be followed by a half-space to separate it from the parameters that follow, and the configuration file path should be written as “D:1.ini”, not “D:1.ini “.

Now open the Service Settings window, in which you can see the new service named Nginx above, and open the Properties window to see the command “srvstart.exe Nginx -c D:1.ini” running. This command will start nginx.exe (i.e., the program after “startup=” in the D:1.ini configuration file) after the next system boot. Later, you can use the Nginx service in the background, so that it can run covertly and automatically start when the server needs to be restarted (Figure 3).

2020A-YCYX-(3)

Tip.

If you don’t use this service anymore, start “C:Windowssvc.exe” as administrator and enter r as prompted, enter and then enter nginx (i.e. service name), and finally enter x to exit.

Leave a Comment