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

  • Home
  • SEARCH
  • 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 8166211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:46:56+00:00 2026-06-06T19:46:56+00:00

I wish to make a nested for loop in order to process some files.

  • 0

I wish to make a nested for loop in order to process some files. I have looked extensively for the solution, and have found many similar versions, but since this is my first time I am having trouble combining methods to do what I want.

Basically – I want a FOR /L loop that cycles through a range of padded numbers from 001 to say 500.

I know I can specify a range (1,1,500), but obviously not as (001,001,500). How can I add the 00, and then subsequently when %%a is >9, just a 0? I imagine this is as a sting but perhaps there is another way?

My code as I wished it to be (obviously wrong):

@echo off
for %%a in (001,001,500) do (
echo %%a
for %%s in (control scenario) do (
echo %%s
svic_ensemble.exe 28009_Trent_at_Colwick.cal Trent_%%s_%%a.txt 28009_Trent_at_Colwick.txt     Trent_%%s_%%a.out
)
)
pause

Many thanks

Ed

  • 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-06T19:46:57+00:00Added an answer on June 6, 2026 at 7:46 pm

    You can solve it with string manipulations.
    First prefix the number with two zeros and then take only the last three characters.

    setlocal EnableDelayedExpansion
    for /L %%n in (1 1 500) do (
      set "num=00%%n"
      set "num=!num:~-3!"
      echo !num!
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some REST web services implemented in WCF. I wish to make these
I have a large system that I have coded and I wish to make
Several articles and blogs I have read suggest placing assemblies I wish to make
i have a wall on each profile, and i wish to make it smarter,
I have a custom slider-type object, that I wish to make more usable. Currently
I have a very simple question to ask! I wish to make a website
I have created a patch that runs successfully, however I only wish to make
I have several variables coming from an array in $POST_['array'] i wish to make
I wish to make a gallery similar to http://welovewp.com Can anyone guess, how this
I have a column url encoded with urlencode in php. I wish to make

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.