如何使用命令提示符重新启动服务? [英] How to restart service using command prompt?

查看:259
本文介绍了如何使用命令提示符重新启动服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Inno Setup在[Icons]部分的命令提示符下重新启动Windows服务.请帮助我解决问题.

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

推荐答案

您可以使用sc start [service]启动服务,使用sc stop [service]停止服务.对于某些服务,net start [service]也在做同样的事情.

You can use sc start [service] to start a service and sc stop [service] to stop it. With some services net start [service] is doing the same.

但是,如果要在同一批次中使用它,请注意,sc stop不会等待服务停止.在这种情况下,您必须使用net stop [service],然后使用net start [service].这将同步执行.

But if you want to use it in the same batch, be aware that sc stop won't wait for the service to be stopped. In this case you have to use net stop [service] followed by net start [service]. This will be executed synchronously.

这篇关于如何使用命令提示符重新启动服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆