Help to break loop
Posted: 02 Feb 2023 21:45
Sup Guys,
I need a help with my code. I made an Warning Screen where there are some words that blinks and to make this happen I did a loop, But I need when the user hit any key, stop the loop and continue to execute the next commands. I tried a lot of things, like pause >nul , pause /nobreak , some if conditions, but none of them worked. Can you gays have any suggestion?
Here is the code:
@ECHO OFF
MODE CON: COLS=150 LINES=50
CHCP 65001
REM.-- Preparando processador de comandos
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION
set "text1=AO CONFIGURAR O CSO EXTRA"
set "text2=NÃO ALTERE NADA, APENAS"
set "text3=CLIQUE EM NEXT"
set /p "answer=Pressione qualquer tecla para continuar..." < nul
if not "%answer%" == "" goto end
cls
ECHO [1;1H
echo.
echo [1;48;5;9;38;5;11;4mIniciando Configuração Vivo - Tdata[0m
call :progress %count% %total%
:loop
ECHO [4;1H
echo.
echo.
echo [91m**********************************************[0m
echo [91m* *[0m
for /f "tokens=1-5 delims= " %%a in ("%text1%") do (
if !random! equ 1 (
echo [91m* [93m%%a %%b %%c %%d %%e[0m [91m*[0m
) else (
echo [91m* *[0m
)
)
for /f "tokens=1-4 delims= " %%a in ("%text2%") do (
if !random! equ 1 (
echo [91m* [93m%%a %%b %%c %%d[0m [91m*[0m
) else (
echo [91m* *[0m
)
)
for /f "tokens=1-3 delims= " %%a in ("%text3%") do (
if !random! equ 1 (
echo [91m* [93m%%a %%b %%c[0m [91m*[0m
) else (
echo [91m* *[0m
)
)
echo [91m* *[0m
echo [91m**********************************************[0m
echo.
echo.
ping localhost -n 2 > nul
set /a random=%random% %% 2 + 1
goto loop
REM Here goes next commands
I would appreciate any help ans tips, thanks a lot
I need a help with my code. I made an Warning Screen where there are some words that blinks and to make this happen I did a loop, But I need when the user hit any key, stop the loop and continue to execute the next commands. I tried a lot of things, like pause >nul , pause /nobreak , some if conditions, but none of them worked. Can you gays have any suggestion?
Here is the code:
@ECHO OFF
MODE CON: COLS=150 LINES=50
CHCP 65001
REM.-- Preparando processador de comandos
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION
set "text1=AO CONFIGURAR O CSO EXTRA"
set "text2=NÃO ALTERE NADA, APENAS"
set "text3=CLIQUE EM NEXT"
set /p "answer=Pressione qualquer tecla para continuar..." < nul
if not "%answer%" == "" goto end
cls
ECHO [1;1H
echo.
echo [1;48;5;9;38;5;11;4mIniciando Configuração Vivo - Tdata[0m
call :progress %count% %total%
:loop
ECHO [4;1H
echo.
echo.
echo [91m**********************************************[0m
echo [91m* *[0m
for /f "tokens=1-5 delims= " %%a in ("%text1%") do (
if !random! equ 1 (
echo [91m* [93m%%a %%b %%c %%d %%e[0m [91m*[0m
) else (
echo [91m* *[0m
)
)
for /f "tokens=1-4 delims= " %%a in ("%text2%") do (
if !random! equ 1 (
echo [91m* [93m%%a %%b %%c %%d[0m [91m*[0m
) else (
echo [91m* *[0m
)
)
for /f "tokens=1-3 delims= " %%a in ("%text3%") do (
if !random! equ 1 (
echo [91m* [93m%%a %%b %%c[0m [91m*[0m
) else (
echo [91m* *[0m
)
)
echo [91m* *[0m
echo [91m**********************************************[0m
echo.
echo.
ping localhost -n 2 > nul
set /a random=%random% %% 2 + 1
goto loop
REM Here goes next commands
I would appreciate any help ans tips, thanks a lot