Does anyone have an idea how I can reduce this code into some type of loop, rather than block after block of the same code...
Code: Select all
@echo off
color 07
setlocal EnableDelayedExpansion
call :configColor
call :applyColor 01 " "
call :applyColor 17 " HELLO WORLD "
pathping -q 1 -p 100 localhost >nul
cls
call :applyColor 01 " "
call :applyColor 17 " HELLO WORLD "
pathping -q 1 -p 100 localhost >nul
cls
call :applyColor 01 " "
call :applyColor 17 " HELLO WORLD "
pathping -q 1 -p 100 localhost >nul
cls
call :applyColor 01 " "
call :applyColor 17 " HELLO WORLD "
pathping -q 1 -p 100 localhost >nul
cls
call :applyColor 01 " "
call :applyColor 17 " HELLO WORLD "
pathping -q 1 -p 100 localhost >nul
cls
call :applyColor 01 " "
call :applyColor 17 " HELLO WORLD "
pathping -q 1 -p 100 localhost >nul
cls
call :applyColor 01 " "
call :applyColor 17 " HELLO WORLD "
pathping -q 1 -p 100 localhost >nul
cls
call :applyColor 01 " "
call :applyColor 17 " HELLO WORLD "
pathping -q 1 -p 100 localhost >nul
cls
call :applyColor 01 " "
call :applyColor 17 " HELLO WORLD "
pathping -q 1 -p 100 localhost >nul
cls
call :applyColor 01 " "
call :applyColor 17 " HELLO WORLD "
pathping -q 1 -p 100 localhost >nul
cls
call :applyColor 01 " "
call :applyColor 17 " HELLO WORLD "
pathping -q 1 -p 100 localhost >nul
cls
call :applyColor 01 " "
call :applyColor 17 " HELLO WORLD "
pathping -q 1 -p 100 localhost >nul
cls
call :applyColor 01 " "
call :applyColor 17 " HELLO WORLD "
pathping -q 1 -p 100 localhost >nul
cls
call :applyColor 01 " "
call :applyColor 17 " HELLO WORLD "
pathping -q 1 -p 100 localhost >nul
cls
PAUSE
:applyColor
set "param=^%~2" !
set "param=!param:"=\"!"
findstr /p /A:%1 "." "!param!\..\X" nul
<nul set /p ".=%DEL%%DEL%%DEL%%DEL%%DEL%%DEL%%DEL%"
exit /b
:configColor
:: Commands for color show config
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
set "DEL=%%a"
)
<nul > X set /p ".=."
exit /b