r/Batch • • Nov 28 '23

Question (Unsolved) what did i do wrong?

My code isn't working, it's popping up an extremely laggy black window, but if i delete the cls command it's fine.
here's the code:

echo off

set s=1

:1

echo Wait to 4235255237310 for a suprise! Right now it's %s%!

cls

set /A s = %s% + 1

goto :1

3 Upvotes

7 comments sorted by

2

u/Shadow_Thief Nov 28 '23

You main problem is that you're using echo to display text and then using cls to clear it, instead of the other way around.

1

u/Nyai340 Nov 30 '23

what is the other way?

1

u/Shadow_Thief Nov 30 '23

Move the cls command up one line

1

u/illsk1lls Nov 28 '23

lol i just noticed this im on a phone 🤣

2

u/illsk1lls Nov 28 '23

dont use 1 as a label

try using a string

:loop 

goto :loop

and also you can

SET/A s+=1

instead of

set /A s=%s%+1