This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Batch Script - Print colored text with debug.exe NEW VERSION

By: bl8086 on Aug 2nd, 2012 (edited)  |  syntax: None  |  size: 2.32 KB  |  views: 1,000  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. @echo off
  2. rem Script written by BrendanLS [bl8086] / 640kbworld.forum.st
  3. rem You need DEBUG.EXE executable in your system.
  4. setlocal enabledelayedexpansion
  5. set /a _er=0
  6. set /a _n=0
  7. set _ln=%~4
  8. goto init
  9. :howuse ----------------------------------------------------------------
  10.         echo ------------------
  11.         echo ECOL.BAT - ver 2.0
  12.         echo ------------------
  13.         echo Print colored text as batch script without temporary files.
  14.         echo Written by BrendanLS.
  15.         echo.
  16.         echo Syntax:
  17.         echo ECOL.BAT [COLOR] [X] [Y] "Insert your text here"
  18.         echo COLOR value must be a hexadecimal number like "color /?" information
  19.         echo.
  20.         echo Example:
  21.         echo ECOL.BAT F0 20 30 "An african or a european swallow?"
  22.         echo.
  23.         goto :eof
  24. :error ----------------------------------------------------------------
  25.         set /a "_er=_er | (%~1)"
  26.         goto :eof
  27. :gcnvhx ------------------------------------------------------------------------
  28.         set _cvhx=
  29.         set /a _cvint=%~1
  30. :cnvhx
  31.         set /a "_gch = _cvint & 0xF"
  32.         set _cvhx=!nsys:~%_gch%,1!%_cvhx%
  33.         set /a "_cvint = _cvint >> 4"
  34.         if !_cvint! neq 0 goto cnvhx
  35.         goto :eof
  36. :init --------------------------------------------------------------------------
  37.         if "%~4"=="" call :error 0xff
  38.         (
  39.                 set /a _cl=0x%1
  40.                 call :error !errorlevel!
  41.                 set _cl=%1
  42.                 call :error "0x!_cl! ^>^> 8"
  43.                 set /a _px=%2
  44.                 call :error !errorlevel!
  45.                 set /a _py=%3
  46.                 call :error !errorlevel!
  47.         ) 2>nul 1>&2
  48.         if !_er! neq 0 (
  49.                 echo.
  50.                 echo ERROR: value exception "!_er!" occurred. Check memory out.
  51.                 echo.
  52.                 goto howuse
  53.         )
  54.         set nsys=0123456789ABCDEF
  55.         set /a cnb=0
  56.         set /a cnl=0
  57.         set _cvhx=0
  58.         set _cvint=0
  59.         set _cvmhx=0
  60. :parse -------------------------------------------------------------------------
  61.         set _ch=!_ln:~%_n%,1!
  62.         if "%_ch%"=="" goto perform
  63.         set /a "cnb += 1"
  64.         if %cnb% gtr 7 (
  65.                 set /a cnb=0
  66.                 set /a "cnl += 1"
  67.         )
  68.         set bln%cnl%=!bln%cnl%! "!_ch!" %_cl%
  69.         set /a "_n += 1"
  70.         goto parse
  71. :perform -----------------------------------------------------------------------
  72.         set /a "in = ((_py * 0xA0) + (_px << 1)) & 0xFFFF"
  73.         call :gcnvhx %in%
  74.         set ntr=!_cvhx!
  75.         set /a jmp=0xe
  76.         set bl8086str=echo.h 0 0
  77.         @for /l %%x in (0,1,%cnl%) do (
  78.                 set bl8086str=!bl8086str!^&echo.eb800:!ntr! !bln%%x!
  79.                 set /a "in=!jmp! + 0x!ntr!"
  80.                 call :gcnvhx !in!
  81.                 set ntr=!_cvhx!
  82.                 set /a jmp=0x10
  83.         )
  84.         (
  85.         echo %bl8086str%
  86.         echo.q
  87.         ) |debug >nul 2>&1
clone this paste RAW Paste Data