tasklist lists all processes.
tasklist | find "NxWin.exe" will list NxWin.exe (if it exists)
I can't be bothered to figure out the batch file syntax, but you basically need to stick the result of
tasklist | find "NxWin.exe" into a variable (or check directly) and see if it's empty. If it's empty, then NxWin.exe is gone, so you wanna taskkill NxSSH.exe.
Edit: Better yet, use
tasklist | find /C "mirc.exe" and the result will be 1 if it exists and 0 otherwise, so that could be checked a lot easier.
Edit: oh screw you
download
http://gifpaste.org/tmp/sleep.exe and stick it in your windows directory
code:
@echo off
rem fuck you batch script.
set proc=NxWin.exe
:crap
tasklist | find /C "%proc%" > nul
if "%ERRORLEVEL%" == "1" (
echo I can't find %proc%
taskkill /F /IM NxSSH.exe
goto sonicsamfails
)
echo I've found nothing!
sleep 1
goto crap
:sonicsamfails
echo I killed it