Before I run the nodejs program, I entered a similar command in the cmd command to Start node D: \ NodeJs \ demo_express \ microblog \ app. after the jscmd command is disabled, the nodejs program is also automatically closed. In the production environment (Development and debugging programs), this method can fully meet the needs, but in the release environment, it is best to configure as a service, in this way, you can avoid adverse consequences caused by server restart, illegal window shutdown, and other reasons. The following are two solutions I have tried: 1. save the cmd command in the bat file and add the bat file to the program. Advantages: easy to implement and easy to understand. Disadvantage: Although nodejs can be started after the server is restarted, the node. js program will be automatically closed if it is closed illegally due to a cmd command window running, therefore, this method is temporary. 2. windows Service Mode advantages: Not afraid to restart, there is no cmd command window disadvantages: Implementation is relatively complicated, not easy to understand implementation steps: 1> Create a bat file named run. bat, enter node D: \ NodeJs \ demo_express \ microblog \ app. js (modify the command as needed) and save it. 2> Create a service. Refer. register the js program as a windows service and set the Application attribute in step 1 to the path where the bat file is located. find the service in the windows Service list, make sure that the Startup type is automatic, and then click Start. The cmd command box is not found. After logging out on your computer and logging on again, you will find that the service can be started normally and the nodejs program can run normally. This indicates that the service is successfully configured.