Advertisement
cornbeetle

Display All Color Combinations (back/foreground in Batch)

Dec 14th, 2016
842
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 0.91 KB | None | 0 0
  1. @echo off
  2. setlocal EnableDelayedExpansion
  3. color 07
  4.  
  5. :start
  6. call :initColor
  7.  
  8. :: Apply each color combination to the phrase "Hello World"
  9. for %%G in (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F) do (
  10.     for %%U in (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F) do (
  11.         ping localhost -n 1 >Nul
  12.         set "var=Hello World %%G%%U" !
  13.         findstr /p /A:%%G%%U "." "!var!\..\X" nul
  14.         <nul set /p ".=%DEL%%DEL%%DEL%%DEL%%DEL%%DEL%%DEL%"
  15.     )
  16. )
  17. del X
  18.  
  19. echo.
  20. echo.
  21. echo Press any key to show a WIDE screen version (better readability)
  22. echo monitor must be at least 24"
  23. pause >nul
  24. cls
  25. MODE CON: COLS=222 LINES=25
  26. goto:start
  27. pause>nul
  28.  
  29.  
  30. :: Credit to Jeb for color conversion routine. See URL http://stackoverflow.com/questions/4339649/how-to-have-multiple-colors-in-a-windows-batch-file
  31. :initColor
  32. for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
  33.   set "DEL=%%a"
  34. )
  35. <nul > X set /p ".=."
  36. exit /b
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement