使用batch(.bat)文件停止和启动Windows服务 [英] stop and start windows service using batch(.bat) file

查看:637
本文介绍了使用batch(.bat)文件停止和启动Windows服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


如何在批处理文件中等待Windows服务停止然后执行下一个命令?我能够停止服务,但无法执行移动命令.
这是我的代码:

Hi
How to make a wait in batch file for a windows service to stop and then execute next command? I am able to stop service but unable to execute move command.
Here is my code :

IF EXIST ..\Temp\UpdateService.exe (
  SC stop UpdateService
  :pause
  tasklist | find /i "sc.exe" >nul
  if not %errorlevel%==1 goto :pause
      move ..\Temp\UpdateService.exe  ..\Tools\Update
  SC start UpdateService

  ) ELSE (
      echo filename. missing.
  )

推荐答案


这篇关于使用batch(.bat)文件停止和启动Windows服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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