troubleshooting Question

i need to know how to run if statements multiple lines in a batch file.

Avatar of sasi v
sasi v asked on
* batfile* BatWindows Batch
19 Comments3 Solutions209 ViewsLast Modified:
hi experts,

i need to know how to run if statements multiple lines in a batch file.
first statement only running. next if statement is not running. its coming out of the batch file.

code:
if %programName%=="CD41_2018" or IF %programName%=="CD41_2019"  
(
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

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


 like that goes on


help me regarding that how to run all if statement??
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 3 Answers and 19 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 19 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros