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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:37:07+00:00 2026-06-18T09:37:07+00:00

I’m trying to make a for statement that have to echo a string that

  • 0

I’m trying to make a for statement that have to echo a string that contains only two character.
The type of string would by like “aaabbb”.
My problem is that the echo command make a new line each time I call it, so if I write something like:

FOR %%i IN (<condition>) DO ECHO a
FOR %%i IN (<condition>) DO ECHO b

The result would be something like:

a
a
a
b
b
b

What I thought was “Maybe echoing a unique string?”
So I wondering if that a method to append a character/variable in another variable.

Thank you for your support,
Waiting for a response,
Dave.

  • 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-18T09:37:08+00:00Added an answer on June 18, 2026 at 9:37 am

    SOLUTION:

    @ECHO off &SETLOCAL EnableDelayedExpansion
    
    :vars
        SET "fC=a"
        SET "sC=b"
        SET "toEcho="
    
        PAUSE
    
        FOR /L %%f IN (1, 1, 3) DO (
            IF %%f == 1 SET "toEcho=!toEcho!%fC%"
            IF %%f == 2 SET "toEcho=!toEcho!%fC%"
            IF %%f == 3 SET "toEcho=!toEcho!%fC%"
        )
    
        FOR /L %%f IN (4, 1, 6) DO (
            IF %%f == 4 SET "toEcho=!toEcho!%sC%"
            IF %%f == 5 SET "toEcho=!toEcho!%sC%"
            IF %%f == 6 SET "toEcho=!toEcho!%sC%"
        )
    
        ECHO %toEcho%
    
    GOTO end
    
    :end
        PAUSE
    

    The real project was a bar.
    I give the percentage of the done level as a parameter to a label and it make for me a full loading bar!

    The first parameter is the how-big-the-bar-have-to-be info.

    :bar size loaded
        CLS
    
        SET /A "toDo=(%~1*%~2)/100"
        SET /A "remains=%~1-%toDo%"
        ECHO %~2%%
    
        SET "bar_up=%corUL%"
        FOR /L %%i IN (1, 1, %~1) DO SET "bar_up=!bar_up!%linHo%"
        SET "bar_up=!bar_up!%corUR%
        ECHO %bar_up%
    
        SET "bar_ce=%linVe%"
        FOR /L %%i IN (1, 1, %toDo%) DO SET "bar_ce=!bar_ce!%barDo%"
        FOR /L %%i IN (1, 1, %remains%) DO SET "bar_ce=!bar_ce!%barSp%"
        SET "bar_ce=!bar_ce!%linVe%
        ECHO %bar_ce%
    
        SET "bar_do=%corDL%"
        FOR /L %%i IN (1, 1, %~1) DO SET "bar_do=!bar_do!%linHo%"
        SET "bar_do=!bar_do!%corDR%
        ECHO %bar_do%
    
        EXIT /B
    

    The others variables are:

    corUL = the left-up corner character

    corUR = the right-up corner character

    corDL = the left-down corner character

    corDR = the right-down corner character

    linHo = the horizontal line character

    linVe = the vertical line character

    barDo = the character that indicate the done-part of the bar

    barSp = the character that indicate the empty-part of the bar

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post
I would like to count the length of a string with PHP. The string
I have a small JavaScript validation script that validates inputs based on Regex. I
I am trying to render a haml file in a javascript response like so:
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I would like to run a str_replace or preg_replace which looks for certain words

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.