Assaultz
Member

CODE :
[HIDE]@echo off&& setlocal&& cls
REM Draws a rectangle with X1, Y1, Width and Height specified by inputs
set "x=%1"&& set "y=%2"&& set "w=%3"&& set "h=%4"
REM Place blank lines above
set /a yBefore=%y% - 1
for /l %%a in (1,1,%yBefore%) do (echo.)
REM Create rectangle components
set /a xRemaining=%x%-1
set wRemaining=%w%
:topLineGen
if NOT %xRemaining% == 0 set /a xRemaining-=1&& set "topLine=%topLine% "&& goto :topLineGen
set "topLine=%topLine%#"&& set /a wRemaining-=1
if NOT %wRemaining% == 0 goto :topLineGen
REM Render top line
echo %topLine%
REM Create middle line
set xRemaining=%x%
set /a wRemaining=%w%-2
:midLinePreGen
if %xRemaining% GTR 1 set /a xRemaining-=1&& set "midLine=%midLine% "&& goto :midLinePreGen
set "midLine=%midLine%#"
:midLineGen
if %wRemaining% GTR 0 set /a wRemaining-=1&& set "midLine=%midLine% "&& goto :midLineGen
if %w% GTR 1 set "midLine=%midLine%#"
REM Render middle lines
set /a midLinesRemaining=%h%-2
:renderMidLines
if %midLinesRemaining% GTR 0 echo %midLine%&& set /a midLinesRemaining-=1&& goto :renderMidLines
REM If the height is greater than 1, render a bottom line (we can re-use %topLine% variable)
if %h% GTR 1 echo %topLine%
endlocal
exit /b
[/HIDE]
Enjoy
