Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8775459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:48:14+00:00 2026-06-13T18:48:14+00:00

I can do a while loop in DOS batch file like this: @REM initialize

  • 0

I can do a while loop in DOS batch file like this:

@REM initialize test value to be "true"
@SET intCounter=1

:while

@REM test condition
@IF %intCounter% GTR 10 (GOTO wend)

@REM procedure where condition is "true"
@echo %intCounter%

@REM set new test value
@SET /a intCounter=intCounter+1

@REM loop
@GOTO while

:wend

@PAUSE  

This will loop ten times.
My question are two folds.

  1. How can I also control the end of the loop. I tried set end =1 and replace 10 with %end%, this does not work.

  2. How to read input from keyboard and set them into iniCounter and end.

Thanks a lot.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T18:48:15+00:00Added an answer on June 13, 2026 at 6:48 pm

    I don’t know what you did, but

    @set end=5
    :while
    @IF %intCounter% GTR %end% (GOTO wend)
    

    does work,or

    @set /p end="Enter the end:"
    

    if you want it to be entered by the user

    And since your question is tagged ‘windows’, you might be better off with

    set /p start="From:"
    set /p end="To:"
    for /l %%i in (%start%, 1, %end%) do (
        echo %%i
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This looks like a do-while loop with odd syntax. Can anyone identify a language?
I am basically just wondering how can I make this while loop repeat continuously
I know I can simply write a while loop for this.. I'm just curious
I need to read a file using a Do/While loop. How can I read
No matter what I do, I can't get this while loop to work; unless
How can I convert this while-loop into a function, so I can call it
Can I transform this loop in a while loop ? int i=0; for (NSDictionnary
I've spent HOURS on this and I can't figure it out. My while loop
How can I echo out value after the while loop. If I do the
I have a tabled view in a while loop, where a user can view

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.