|
Answer» Script for launch a program and close a window I need to identificate correctly a window appear when I open a program. This window is not configurable in this program, so I need close it with the script.
How can I determine and force the closing of this window ?
BEST Regards happy New Year Code: [Select]@echo off
start pair1.bat start pair2.bat
sleep 6
tasklist | findstr "%1"
tasklist | findstr "%1" > notepid.txt
for /f "tokens=1,2 delims= " %%i in (notepid.txt) do ( echo pid=%%j
taskkill /F /pid %%j
)
Rem We assume only pair1.bat and pair2.bat use sleep.exe Rem We taskkill sleep.exe Output: C:\test>killpair.bat sleep sleep.exe 3544 Console 1 1,000 K sleep.exe 2340 Console 1 1,000 K pid=3544 SUCCESS: The process with PID 3544 has been terminated. pid=2340 SUCCESS: The process with PID 2340 has been terminated.
If I screw my eyes up I can SEE that the very fuzzy screen shot is SHOWING Autohotkey, so I am surprised the OP isn't asking in a forum specialising in that tool. Looks a bit script-kiddyish to me.
Does start and taskkill workSomething like that can usually be removed using a debugger, if you KNOW what your doing. I can't read what the message says, but I trust you that it's not a REGISTRATION prompt.
|