0

I want to add x times "# " to a string.

This is my attempt:

set line=

for /L %%a in (1,1,%amount%) do (
    set "line=%line%# "
)

In other programming languages, for example python, it'd look like this:

line = ""

for i in range(amount):
    line += "# "

But, I have no clue how this would work in batch... I'd be very happy if somebody could help me, thanks :)

TaskID
  • 33
  • 1
  • 7
  • 2
    In a for-loop, you can't access the current value with `%line%`, but with `!line!` – jeb Mar 04 '21 at 10:02
  • 1
    …which only works when [delayed variable expansion](https://ss64.com/nt/delayedexpansion.html) is enabled… – aschipfl Mar 04 '21 at 10:26

0 Answers0