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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:10:43+00:00 2026-06-05T21:10:43+00:00

I have a question about if – else structure in a batch file. Each

  • 0

I have a question about if – else structure in a batch file. Each command runs individually, but I couldn’t use "if – else" blocks safely so these parts of my programme doesn’t work. How can I do make these parts run? Thank you.

IF %F%==1 IF %C%==1 (
    ::copying the file c to d
    copy "%sourceFile%" "%destinationFile%"
    )
ELSE IF %F%==1 IF %C%==0 (
    ::moving the file c to d
    move "%sourceFile%" "%destinationFile%"
    )

ELSE IF %F%==0 IF %C%==1 (
    ::copying a directory c from d, /s:  boş olanlar hariç, /e:boş olanlar dahil
    xcopy "%sourceCopyDirectory%" "%destinationCopyDirectory%" /s/e
    )
ELSE IF %F%==0 IF %C%==0 (
    ::moving a directory
    xcopy /E "%sourceMoveDirectory%" "%destinationMoveDirectory%"
    rd /s /q "%sourceMoveDirectory%"
    )
  • 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-05T21:10:45+00:00Added an answer on June 5, 2026 at 9:10 pm

    Your syntax is incorrect. You can’t use ELSE IF. It appears that you don’t really need it anyway. Simply use multiple IF statements:

    IF %F%==1 IF %C%==1 (
        ::copying the file c to d
        copy "%sourceFile%" "%destinationFile%"
    )
    
    IF %F%==1 IF %C%==0 (
        ::moving the file c to d
        move "%sourceFile%" "%destinationFile%"
    )
    
    IF %F%==0 IF %C%==1 (
        ::copying a directory c from d, /s:  boş olanlar hariç, /e:boş olanlar dahil
        xcopy "%sourceCopyDirectory%" "%destinationCopyDirectory%" /s/e
    )
    
    IF %F%==0 IF %C%==0 (
        ::moving a directory
        xcopy /E "%sourceMoveDirectory%" "%destinationMoveDirectory%"
        rd /s /q "%sourceMoveDirectory%"
    )
    

    Great batch file reference: http://ss64.com/nt/if.html

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

Sidebar

Related Questions

i have question about why should we use return in get,if dont use what
I saw a lot of examples of CopyStream implementation but I have question about
I have question about pointers in C. Each pointer has 4 bytes in memory
I'm learning asp.net. I have question about example buttons I can use two types
Have a question about full text search. I have a query that works, but
i have question about finding maximum x or y-value in text file. This is
Today I have question about Eclipse . I use this IDE very long and
I have a question about the objective-C. I use the following code to add
I have question about normalization. Suppose I have an applications dealing with songs. First
I have question about interpreting strings as packed binary data in C++. In python,

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.