Current location - Quotes Website - Team slogan - Remote monitoring whether a program port is started with bat. If so, start a local exe(# good).
Remote monitoring whether a program port is started with bat. If so, start a local exe(# good).
If the local machine is not connected to the remote program, remote port monitoring needs other tools, which is difficult to realize on bat.

The other situation is simple: if the local and remote programs you described are connected, I wrote you a bat. You can try. This bat uses the local netstat command to judge whether there is a corresponding address port connection locally, so as to judge whether the remote program is started.

@ Turn off echo

Set /p var= Please enter the destination address port.

:a

netstat-an | findstr“% var %”

(if% errorlevel% = = 0 (start/d "c: \ users \ by \ desktop \ 20160122" grab.exe) Else Echo has no process &; & go to a)

discontinue

When the target address is in the port, fill in the IP address and port of your remote program in the bat running window after bat runs, and the format is192.168.1.1:12345.

Start/d "c: \ users \ by \ desktop \ 20160122" grab.exe quotation marks are the absolute path of the program and can be modified according to your own needs. The quotation marks are followed by the program name, which can be modified according to your own needs.

Pure hand tour, hope to adopt.