How can you create a limited loop in a batchfile program?

Whodeyy1234

So basically I have been looking all over the internet trying to find a good way of doing this: Create a limited loop in my batchfile program. I have found no answer. An example I tried is this:

@echo off
echo Hello this is your program.
pause

set i= 0
: test
set i= i + 1

if %i% == 5 goto exit
goto test
: exit
echo good

pause
exit

I later found out that I can't just make the "i" variable like that. When I try to make it a variable it makes me put an input in the command prompt of the program and I don't want that. I want this to run maybe 5 times, then quit running and go to something else. If you can answer and help me thanks.

wallyk
for %i in (1 2 3 4 5) do echo good %i

results:

enter image description here

Okay, here it is in the form you want. This ran on Windows XP:

enter image description here

It depends on set /a to evaluate the right side as an arithmetic expression. More than addition is supported. Type help set to learn more.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to mention C:\Program Files in batchfile

From Dev

How can I run netsh using batchfile?

From Dev

Can you use a for loop to create array names?

From Dev

Can you use a for loop to create array names?

From Dev

Can you tell me how this program is working?

From Dev

How do you create objects using a for loop

From Dev

How do you create objects using a for loop

From Dev

How can I exit the loop in this program

From Dev

How can i use a while loop on this program?

From Dev

How can you manipulate the iterator in a for loop in python?

From Dev

How I Can Create A Launcher For a Program

From Dev

How to run limited amount of instances of program?

From Dev

How do you create a program launcher with administrative privileges using Alacarte?

From Dev

How can you create an accessoryInputView in a Storyboard design?

From Dev

How can you create a .aws folder?

From Dev

How can I make a while loop only run a limited number of times?

From Dev

How can you create an object, set it exactly equal to another object, and modify it without affecting the old object inside of a loop?

From Dev

How can you know if executing a program requires root?

From Dev

How can you get the number of the processes where program is started?

From Dev

How can you know if executing a program requires root?

From Dev

How can you figure out which program/process is creating a file?

From Dev

How can I create a loop, and interact with it, in Python?

From Dev

How do you create a flicker free Java game loop?

From Dev

How do you create a for loop using a variable in javascript?

From Dev

How do you create objects that have an instance pointer of itself in a loop?

From Dev

How do you create multiple JLabels with a while loop

From Dev

How do you create a for loop with a changeable number of iterations?

From Dev

How do you create a loop that reads ints by their individual character

From Dev

How can I get return value ( string ) from called Python by BatchFile

Related Related

  1. 1

    How to mention C:\Program Files in batchfile

  2. 2

    How can I run netsh using batchfile?

  3. 3

    Can you use a for loop to create array names?

  4. 4

    Can you use a for loop to create array names?

  5. 5

    Can you tell me how this program is working?

  6. 6

    How do you create objects using a for loop

  7. 7

    How do you create objects using a for loop

  8. 8

    How can I exit the loop in this program

  9. 9

    How can i use a while loop on this program?

  10. 10

    How can you manipulate the iterator in a for loop in python?

  11. 11

    How I Can Create A Launcher For a Program

  12. 12

    How to run limited amount of instances of program?

  13. 13

    How do you create a program launcher with administrative privileges using Alacarte?

  14. 14

    How can you create an accessoryInputView in a Storyboard design?

  15. 15

    How can you create a .aws folder?

  16. 16

    How can I make a while loop only run a limited number of times?

  17. 17

    How can you create an object, set it exactly equal to another object, and modify it without affecting the old object inside of a loop?

  18. 18

    How can you know if executing a program requires root?

  19. 19

    How can you get the number of the processes where program is started?

  20. 20

    How can you know if executing a program requires root?

  21. 21

    How can you figure out which program/process is creating a file?

  22. 22

    How can I create a loop, and interact with it, in Python?

  23. 23

    How do you create a flicker free Java game loop?

  24. 24

    How do you create a for loop using a variable in javascript?

  25. 25

    How do you create objects that have an instance pointer of itself in a loop?

  26. 26

    How do you create multiple JLabels with a while loop

  27. 27

    How do you create a for loop with a changeable number of iterations?

  28. 28

    How do you create a loop that reads ints by their individual character

  29. 29

    How can I get return value ( string ) from called Python by BatchFile

HotTag

Archive