Hi all,
I am writing a script to check if two (or more) instances of the same process is running and then run a command.
I have the following code:
:QueryProcess
tasklist | findstr wfica32.exe > nul 2>&1
IF wfica32.exe EQU 1 goto QueryProcess
IF wfica32.exe EQU 2 goto END
goto END
:End
taskkill /F /IM iexplore.exe > nul 2>&1
Exit
But this does not work. Can anyone help me with the code so iexplore gets closed when running more then one instance?
Thanks!
If statement for two running processes
Moderator: DosItHelp
Re: If statement for two running processes
Try this:
Code: Select all
@echo off
:loop
for /f %%a in ('tasklist ^|find /i /c "wfica32.exe" ') do (
if %%a GEQ 2 taskkill /F /IM "iexplore.exe" >nul
)
ping -n 60 localhost >nul
goto :loop
Re: If statement for two running processes
Thanks!
Got it working!
Got it working!