如何从服务获取响应消息并使用批处理文件打印该消息?

How to Get a responce message from service and print that message using batch file?

我需要从服务获取响应消息并使用批处理文件打印该消息。我需要停止 windchill 服务并获取该消息并打印它,如果服务已正确停止,那么我需要启动 windchill 服务..

windchill stop
timeout /t 10 
windchill start

以上代码将以缓冲时间停止和启动服务。但是我需要在服务停止后获取消息并打印该消息。只有当服务正确停止时,我才需要开始我的服务。

好的,所以我没有windchill看到结果。

但根据上一个问题的更新答案:

windchill stop
:wait
timeout /t 5 >nul 2>&1
windchill status | find /I "stopped"
if %errorlevel% equ 0 (
  echo windchill successfully Stopped
  windchill start
  goto :eof
)
goto :wait
```