Batch ELSE help.

July 5, 2011 at 04:48:01
Specs: Windows 7
@echo off
:CHECK
start pv.exe
pv -pn Client.exe
if errorlevel 0 ( GOTO FOUND ) else ( GOTO SELECT )

:FOUND
echo.
echo THE CLIENT WAS FOUND. PLEASE DISABLE IT!
echo CLICK ANYTHING TO CHECK AGAIN.
echo.
pause > nul
goto CHECK

What's wrong? The batch doesn't reed the "else" statement :(


See More: Batch ELSE help.

Report •

#1
July 5, 2011 at 07:32:11
@echo off
:CHECK
start pv.exe
pv -pn Client.exe

if %ERRORLEVEL% 0 GOTO FOUND
::This skips around the else
::also i see no lable for select? perhaps this is the problem?
GOTO SELECT
:FOUND
echo.
echo THE CLIENT WAS FOUND. PLEASE DISABLE IT!
echo CLICK ANYTHING TO CHECK AGAIN.
echo.
pause > nul
goto CHECK
What's wrong? The batch doesn't reed the "else" statement :(

mike


Report •

#2
July 5, 2011 at 10:55:36
Nvm. I fixed the problem with this:

tasklist /FI "IMAGENAME eq LoLLauncher.exe" 2>NUL | find /I /N "LoLLauncher.exe">NUL
if ERRORLEVEL 1 (goto SELECT) else goto FOUND


Report •
Related Solutions


Ask Question