How to restart service using command prompt?

前端 未结 7 1766
一生所求
一生所求 2020-12-29 04:15

I want to restart Windows service using command prompt in [Icons] section using Inno Setup. Please help me to solve the problem.

7条回答
  •  -上瘾入骨i
    2020-12-29 04:57

    To restart a running service:

    net stop "service name" && net start "service name"
    

    However, if you don't know if the service is running in the first place and want to restart or start it, use this:

    net stop "service name" & net start "service name"
    

    This works if the service is already running or not.

    For reference, here is the documentation on conditional processing symbols.

提交回复
热议问题