How do you run a Python script as a service in Windows?

后端 未结 13 1631
你的背包
你的背包 2020-11-22 02:18

I am sketching the architecture for a set of programs that share various interrelated objects stored in a database. I want one of the programs to act as a service which prov

13条回答
  •  心在旅途
    2020-11-22 02:31

    The simplest way to achieve this is to use native command sc.exe:

    sc create PythonApp binPath= "C:\Python34\Python.exe --C:\tmp\pythonscript.py"
    

    References:

    1. https://technet.microsoft.com/en-us/library/cc990289(v=ws.11).aspx
    2. When creating a service with sc.exe how to pass in context parameters?

提交回复
热议问题