how to use multiple if statement without else

HI EXPERTS,

i am trying to move a some text files from sub folder to destination. i have a many programs so i am using If statements to do that copy.

if statement working only in first condition its not moving to another if condition. showing like syntax error. kindly help me.

code is:
SET ProgramPath=%CD%

SET BackupPath=\\ecc9000203\proj\DI_PMTI_SE\PAT\PAT\PATFiles

echo off

TITLE=%programName% BPNO Data serie

IF "%programName%"=="CD41_2018" goto SPLITTER

:SPLITTER
call :DeleteFolder

call :DeleteFolder "BackupPath"
:DeleteFolder [folder-path]

if %programName%=="CD41_2018"  OR IF %programName%=="CD41_20199"
(
for /f "tokens=*" %%A in ('dir /b /s /a-d "%ProgramPath%\%programName%\%dateFile%\*_CD391N.txt" "%ProgramPath%\%programName%\%dateFile%\*_CD533.txt"
      "%ProgramPath%\%programName%\%dateFile%\*_CD391C.txt" "%ProgramPath%\%programName%\%dateFile%\*_CD391E.txt"') do (
    copy "%%~A" "%BackupPath%\PAT BTT Text Files\%programName%\New\"
      ))
      pause
      TIME /T
IF %programName%=="CD42"
(
for /f "tokens=*" %%A in ('dir /b /s /a-d  "%ProgramPath%\%programName%\%dateFile%\*_CD539C.txt" "%ProgramPath%\%programName%\%dateFile%\*_CD539E_CD390.txt"') do (
    copy "%%~A" "%BackupPath%\PAT BTT Text Files\%programName%\New\"
      )))
pause
if %programName%=="C520MCA"
(
for /f "tokens=*" %%A in ('dir /b /s /a-d "%ProgramPath%\%programName%\%dateFile%\*_C520CH_CCk.txt" "%ProgramPath%\%programName%\%dateFile%\*_C520EU_CBS.txt"
      "%ProgramPath%\%programName%\%dateFile%\*_C520NA.txt" "%ProgramPath%\%programName%\%dateFile%\*_C520TW_CCZ.txt"') do (
    copy "%%~A" "%BackupPath%\PAT BTT Text Files\%programName%\New\"
      ))      
      pause

help me.. thank youuu
sasi vAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bill PrewCommented:
Here you go, please study this code until you understand all changes.

@echo off
setlocal

REM WHERE DOES ProgramName GET SET, I DON'T SEE IT???

SET ProgramPath=%CD%

SET BackupPath=\\ecc9000203\proj\DI_PMTI_SE\PAT\PAT\PATFiles

TITLE=%programName% BPNO Data serie 

IF "%programName%"=="CD41_2018" (

    set DoCopy=N
    if "%programname%" == "CD41_2018" set DoCopy=Y
    if "%programname%" == "CD41_20199" set DoCopy=Y
    if "%DoCopy%" == "Y" (
        for /f "tokens=*" %%A in ('dir /b /s /a-d "%ProgramPath%\%programName%\%dateFile%\*_CD391N.txt" "%ProgramPath%\%programName%\%dateFile%\*_CD533.txt" "%ProgramPath%\%programName%\%dateFile%\*_CD391C.txt" "%ProgramPath%\%programName%\%dateFile%\*_CD391E.txt"') do (
            copy "%%~A" "%BackupPath%\PAT BTT Text Files\%programName%\New\"
        )
    )

    if "%programname%" == "CD42" (
        for /f "tokens=*" %%A in ('dir /b /s /a-d  "%ProgramPath%\%programName%\%dateFile%\*_CD539C.txt" "%ProgramPath%\%programName%\%dateFile%\*_CD539E_CD390.txt"') do (
            copy "%%~A" "%BackupPath%\PAT BTT Text Files\%programName%\New\"
        )
    )

    if "%programname%" == "C520MCA" (
        for /f "tokens=*" %%A in ('dir /b /s /a-d "%ProgramPath%\%programName%\%dateFile%\*_C520CH_CCk.txt" "%ProgramPath%\%programName%\%dateFile%\*_C520EU_CBS.txt" "%ProgramPath%\%programName%\%dateFile%\*_C520NA.txt" "%ProgramPath%\%programName%\%dateFile%\*_C520TW_CCZ.txt"') do (
            copy "%%~A" "%BackupPath%\PAT BTT Text Files\%programName%\New\"
        )
    )

    pause

)

Open in new window


»bp
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Bat

From novice to tech pro — start learning today.