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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:34:25+00:00 2026-06-12T21:34:25+00:00

The below simple steps in the batch script is giving me errors. It says

  • 0

The below simple steps in the batch script is giving me errors. It says

'else' is not recognized as an internal or external command,
operable program or batch file.
) was unexpected at this time.

Can some please help?

set var_machine64 = 0

if exist "C:\Program Files (x86)" ( set var_machine64 = 1 )

if !var_machine64! == 1 (
    If exist "C:\Program Files (x86)\Microsoft" (
        echo Microsoft folder not available 
        goto End ) ) 
else (
        If exist "C:\Program Files \Microsoft" (
        echo Microsoft folder not available 
        goto End ) )

:End
Exit
  • 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-12T21:34:26+00:00Added an answer on June 12, 2026 at 9:34 pm

    The else has to be on the same line where you close the last block, i.e. the ):

    if !var_machine64! == 1 (
        If exist "C:\Program Files (x86)\Microsoft" (
            echo Microsoft folder not available 
            goto End
        )
    ) else (
        If exist "C:\Program Files\Microsoft" (
            echo Microsoft folder not available 
            goto End
        )
    )
    

    I took the liberty of fixing indenting and a superfluous space in a folder name as well.

    This fixes your immediate problem of the syntax error but won’t help since the batch file won’t work anyway. You cannot use any whitespace around the = in set statements because otherwise you’re creating a variable that ends in a space with a value that begins with one. So:

    set var_machine64=0
    if exist "C:\Program Files (x86)" ( set var_machine64=1 )
    

    will make things work nicer. Also note that to use delayed expansion you need either setlocal enabledelayedexpansion before that in your batch file or start cmd with /v:on. I just guess you’re not showing the whole file (which is ok, but given the error rate in this short snippet I’d say you should double-check everything else).

    Random side note: It’s not nice to include exit in a batch file because, when run from an interactive session it will kill it. If you just want to exit the batch file (and not the whole command processor with it) use exit /b or goto :eof.

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

Sidebar

Related Questions

The code below is giving me some headache. It's a very simple application that
Below just a simple race between 2 button in 2 threads, and this will
Consider the simple example below of implementing a method in an Enum. One problem
For a simple plot below, is there a way to make matplotlib populate the
I have a simple code below: import java.util.ArrayList; public class BoidList extends ArrayList {
The code pasted below is a simple JSF program, with an idea of having
I am testing this simple code below and it works... $(document).ready( function() { $('.show-modal').click(
I am having trouble with some javascript. The code snippet below creates a simple
The simple code block below can be served up in a static HTML page
The below code is very simple. I have a jQuery autocomplete bound to an

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.