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 8130023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T08:32:34+00:00 2026-06-06T08:32:34+00:00

How can I use a batch file to loop through non-integer values? I’m trying

  • 0

How can I use a batch file to loop through non-integer values?

I’m trying to run my application multiple times with different parameters between 0 and 1 as follows:

!! DO NOT RUN THIS !!
set application=C:\path\to\my\application.exe

for /L %%p in (0, 0.05, 1) do (
  md %%p
  cd %%p
  START %application% %%p
  cd ..
)

But running the above code sends me into an infinite loop, I guess because for /L is looking for integer arguments and 0.05 is converted to 0.

Is it possible to loop through non-integer values using a batch file?

  • 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-06T08:32:39+00:00Added an answer on June 6, 2026 at 8:32 am

    No it’s not possible, as cmd.exe can’t handle in any way real values.

    But you can count integers and calculate later the real value.

    setlocal EnableDelayedExpansion
    for /L %%p in (0, 5, 100) do (
      set "value=00%%p"
      set "value=!value:~-3!"
      set "prefix=!value:~0,1!"
      set "postfix=!value:~-2!"
      set "num=!prefix!.!postfix!"
      md !num!
      pushd !num!
      START %application% !num!
      popd
    )
    

    The code counts now form 0 to 100.
    Each number will prefixed with 00 to ensure that each number has at least three digits (like 2->002).
    Then I take only the last three characters, so all numbers have the same length.

    5->005->005
    15->0015->015
    

    Then the code splits the number into two part

    015->prefix=0 postfix=15
    

    Then set "num=!prefix!.!postfix!" places the dot between the two parts

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to write a batch file so I can use TortoiseHg Annotate
I'm trying to use a batch file to confirm a network connection using ping.
I'm trying to write a windows batch file that can delete files from subdirectories.
I'm writing a batch file for windows command prompt, I want to loop through
I can use this maven plugin maven-jaxb-plugin to generate Java Classes from XSD file.
I found that a lot of Java programs in Windows use .bat batch file
How can I set a batch file to pic up a txt file and
In vb.net, when writting an application, I want to access a batch file that
I am working on a batch file to use as a wrapper for some
I am trying to write a batch file to iteratively execute a fortran compiled

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.