for example: I have saved it in a file named pat2.bat in C:\TEMP
If I enter the command as below:
C:\TEMP>pat2 1 3 *
I get the following output
*
**
***
len%
len%
however I want something like
*
**
***
**
*
Following is the code I am using. The first loop works, however 2nd loop is not
Code: Select all
@echo off
setlocal EnableDelayedExpansion
set /a w=%~1
set /a h=%~2
set char=%~3
:Loop
SET /a ln=%ln%+1
FOR /L %%i IN (1,1,%w%) DO set res=!res!%char%
echo %res%
if not %ln%==%h% goto loop
:loop1
SET /a ln=%ln%-1
FOR /L %%i IN (%w%,-1,2) DO set /a res=!res!%char%
SET len=%%i
SET res1=%res:~0,%len%%
echo %res1%
if not %ln%==1 goto loop1
endlocal