Batch processing has the following characteristics:
1. When you log in to the current window to run, if you close the console, it will be closed together with the program you started.
2, if it is started in the form of start/b, then also in the console to close the latter log off the current window will also be closed together.
3. If started as VBS, logout of the current user will also be closed together.
There are several ways to resolve this:
1, using "Task Scheduler" to start batch processing, there are many trigger points, you can choose "Computer startup" trigger can also achieve the effect of boot, rather than log on to the desktop.
2, there is an error to start the Windows service mode, the "SC" command to register the service, and then in the form of Cmd.exe to boot (c:\windows\system32\cmd.exe/c C:\Python34\Scripts\ Shadowsocks\shadowsocks\run.bat), but this form is ostensibly a start-up unsuccessful service, but essentially the process already has python.exe the process exists, so it is successfully started, and this form is not able to stop or restart the service.
3, use "Bat_to_exe_converter" this software to convert Bat to EXE program, and then use "SC" or "Srvinstw.exe" to register this exe into the service, if the Python program will also face the 2nd step problem, But if you start something else, it is likely to succeed; there is a problem, this conversion program in the implementation of the converted EXE will be in the temporary folder under a "B2e.exe" process, I guess this is the basis for the execution of bat, but the details of what is not known, if you want to use, please be careful!
: http://www.jb51.net/article/20270.htm
4, the ultimate solution, the use of NSSM program
SSM Install <servicename>
Then in the list of services to start, this program for the bat registered as a service is very good, than the above three ways of the reliable.
Reference:
Http://stackoverflow.com/questions/415409/run-batch-file-as-a-windows-service
Windows Server registers the bat batch as a service that runs in the background and logs off correctly