I am using windows , and I want to do a loop inside a bat and to break it when a condition is satisfied , and I dont want to use goto , can some one give me the general way to do it ?
in my case , I want to loop until a file size is bigger than 200 KB , so in my batch I create a file (that’s get bigger with time) , then I want to check it size with loop
if it greater than 200 KB I want to break loop
I am using windows , and I want to do a loop inside a
Share
Unfortunately the batch scripting language doesn’t have
whileloops, onlyforloops with a predetermined amount of iterations, so I’m afraid thatif+gotois your only option. Why are you determined to avoidgotostatements in batch?The following code resembles a common
do-whileloop:Isn’t it elegant enough? I think it is.