2017-10-05 133 views

回答

0

你可以使用Windows提供的sc命令行界面:

import subprocess 
# start the service 
args = ['sc', 'start', 'Service Name'] 
result = subprocess.run(args) 
# stop the service 
args[1] = 'stop' 
result = subprocess.run(args)