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.