nsis获取正在其上运行服务的端口号 [英] nsis get port number on which service is running

查看:134
本文介绍了nsis获取正在其上运行服务的端口号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我正在使用的安装程序脚本之一中,我遇到了获取运行Tomcat服务的端口号的要求.

In one of the installer script I am working on I came across the requirement of getting port number on which tomcat service is running.

nsis中还有一种方法可以通过给定服务名来获取运行它的端口号.

So is there a way in nsis by which given a service name we can get port number on which it is running.

如果不能实现,那么

推荐答案

我假设您不知道tomcat的安装位置(如果已安装).

I assume you do not know where tomcat is installed (if it is installed at all).

一些指针-不确定是否可以在NSIS中实现所有这些功能:

A few pointers - not sure if all this is possible in NSIS:

  1. 使用进程插件来查找tomcat是否正在运行.您将可以通过java.exe进行过滤,但是如果有多个Java进程,则不确定我们可以做什么.

  1. Use Processes plugin to find if tomcat is running. You will be able filter by java.exe, but if there are more than one java processes, not sure what we can do.

假定您找到一个指示tomcat正在运行的Java进程,请使用 nsExec 插件运行netstat命令,再次通过java.exe过滤并解析该行以获取端口号.

Assuming you find one java processes which indicates tomcat running, use nsExec plugin to run netstat command, again filter by java.exe and parse the line to get the port number.

这篇关于nsis获取正在其上运行服务的端口号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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