nsis get port number on which service is running

扶醉桌前 提交于 2019-12-13 07:08:08

问题


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.

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

If not how can it be achieved.


回答1:


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

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

  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.

  2. 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.



来源:https://stackoverflow.com/questions/16981001/nsis-get-port-number-on-which-service-is-running

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!