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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:08:29+00:00 2026-05-28T08:08:29+00:00

I have a batch file in which I have an IF/ELSE IF block. I

  • 0

I have a batch file in which I have an IF/ELSE IF block. I do not want the block itself to be “echoed” to the user, as doing so prints a full screen of complex logic that would be difficult to understand exactly what’s executing out of it. However, I would like the commands that are actually executed within the block to be echoed to the user.

Putting an @ in front of the first IF hides the entire statement and there doesn’t seem to be a way to “unhide” portions. Attempting to use @echo off and @echo on to turn screen reporting off for the main statement and on for the logic branches doesn’t seem to do it either. Help?

  • 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-05-28T08:08:29+00:00Added an answer on May 28, 2026 at 8:08 am

    It’s not very pretty, but it works:

    @echo off
    if 1==1 (
      echo on
      for %%a in (1) do echo command 1
      for %%a in (1) do echo command 2
    )
    

    You can lessen the amount of typing with a little macro. This example also shows how to handle an embedded FOR command. The @ in front of the () results effectively as ECHO OFF for all commands within the DO() clause. Without it, the whole (…) will be echoed as well as each command within.

    @echo off
    setlocal
    set show=for %%a in (1) do
    if 1==1 (
      echo on
      %show% echo command 1
      %show% echo command 2
      for /l %%n in (1 1 5) do @(
        %show% echo loop %%n A command IS shown
        echo loop %%n B command is NOT shown
      )
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to have a batch file which checks what the filesize is of
I have a Batch file which will call a Powershell Script : BATCH FILE
I have a problem. I have a batch file which imitates the UNIX cd
I have a windows batch file in Windows 7 which does something with find.
I have a batch file that will detect if the user has the .Net
I have a batch file which starts multiple instances of simple console application (Hello
I have a batch file running which spits out a text/html file. The batch
I have a process in which i am running a batch file which opens
i have the following batch file, which terminates the iTunes program so, that if
I have a batch file which loops through a content of a text file

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.