- @echo off
- set "process=rdpclip.exe"
- echo;Monitoring...
- set "f="
- :loop
- set "n="
- netstat -on|>nul findstr ":3389\>"&&(set n=Y)
- tasklist /fi "IMAGENAME eq %process%"|>nul find /i "%process%"&&(set n=Y)
- if defined n (
- if not defined f (
- echo;online at %date% %time%
- echo;执行A命令
- )
- set f=1
- ) else (
- if defined f (
- echo;offline at %date% %time%
- echo;执行B命令
- )
- set "f="
- )
- goto loop
复制代码
|