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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:22:37+00:00 2026-06-16T15:22:37+00:00

I am writing a batch script what i am looking for is something so

  • 0

I am writing a batch script what i am looking for is something so that multiple hings be compared with each other

for example i have to look into folders to check what all files are there if there are following files

  abc.wxs
  verify.wxs
  start.wxs
  myname.wxs

i want to go to

 makeadmin

else if there are

  abc.wxs
  verify.wxs
  start.wxs
  myname.wxs
  verifyme.wxs
  abc.dll

i have written some thing like

IF EXIST "abc.wxs" (
IF EXIST "verify.wxs" (
IF EXIST "start.wxs" (
IF EXIST "myname.wxs" (
goto makeadmin
) else (
echo 1
 )
 ) else (
 echo 2
)
) else (
echo 3
)    
) else (
echo 4
)

Now how do i integrate the second part

  • 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-16T15:22:39+00:00Added an answer on June 16, 2026 at 3:22 pm

    You can do this with a “checking buffer”. I mean each file will count +1 to the check variable. Now, if the sum matches the number of checked files it would do something specific.
    Take a look below :

    @echo off
    set sum=0
    
    IF EXIST "abc.wxs" (
    set /a sum=%sum%+1
    )
    IF EXIST "verify.wxs" (
    set /a sum=%sum%+1
    )
    IF EXIST "start.wxs" (
    set /a sum=%sum%+1
    )
    IF EXIST "myname.wxs" (
    set /a sum=%sum%+1
    )
    IF EXIST "verifyme.wxs" (
    set /a sum=%sum%+1
    )
    IF EXIST "abc.dll" (
    set /a sum=%sum%+1
    )
    
    if sum==4 (
    set sum=0
    goto makeadmin
    )
    if sum==6 (
    set sum=0
    <insert whatever you want here>
    )
    
    pause
    

    Generally, I find it quite useful to use counters with numbers. It’s much more convenient for me. I hope it helps.

    P.S. I am setting sum=0 on each case of the 2 “if”s because I haven’t tested this (cause I am on linux right now) and I am afraid that if you return to the beginning of the program, you’ll going to have the sum over-exceed the number 6.

    EDIT
    The above can be shortened and made easier to maintain by using a FOR loop. Also, the set sum=0 is not needed within the IFs. Finally, variables do not need to be expanded within SET /A. set /a sum=sum+1 works, as does set /a sum+=1

    @echo off
    set sum=0
    for %%F in (
      abc.wxs
      verify.wxs
      start.wxs
      myname.wxs
      verifyme.wxs
      abc.dll
    ) do if exist %%F set /a sum+=1
    if sum==4 goto makeadmin
    if sum==6 REM do something else
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a batch script that's gonna be used by multiple windows machine. Each
I'm writing a batch script that switches between ip addresses depending on the users
I'm having a problem with a small batch script that I'm writing. The point
Howdy, I'm writing a batch script that will run on a Windows XP machine.
I have a batch script that launches a tomcat server. The script starts the
I am writing a batch script which makes multiple calls to powershell scripts to
I have a script that is writing variables to a text file, I am
I have a script I'm writing to batch download images from an imageboard via
I'm writing a batch script that needs to install Microsoft Lync if the user
I am writing a batch script to install programs silently, the problem I have

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.