0

As stated in the title I am trying to make a for loop set a variable to a string of numbers, here is my current code

set /p FrameCount=How many frames do you have? (if you have six images in your file that is six Frames do not put five, the program does that for you) 
set /a FrameCount=%FrameCount%-1
for /l %%l in (1,1,%FrameCount%) do (
  set Frames=%Frames%, %%l
)

this should output; 1, 2, 3, 4 if the input is four, but when I use an input of four all I get is; , 4. I tried setting frames to zero before running the for loop but all it outputted was; 0, 4

if anyone knows how to fix it please give me a detailed explanation on how for loops work as I have had trouble with them in the past.

DNABuster
  • 3
  • 3
  • this is for a simple script to write a file that makes it so that I can animate a file used for a Minecraft texture pack that I will likely release to the public when it is finished to help resource pack makers. – DNABuster Jun 04 '22 at 15:07
  • 1
    `call set "Frames=%%Frames%%, %%l"` and `set "frames=%frames:~2%"` after the `for ..%%l` loop – Magoo Jun 04 '22 at 15:19
  • kinda funny actually I just figured it out, switching it to `for /l %%l in (1,1,!FrameCount!) do (` ` set Frames=!Frames!, %%l` `)` fixed it – DNABuster Jun 04 '22 at 15:23

0 Answers0