title: Using if condition in CMD
body: <p>EDIT: I have solved my problem based on suggestions from npocmaka and magoo. Now that i understand it is indentation that caused this, can you guys please suggest how i make my code cleaner in future?</p>
  
  <p>Here's my bat file:</p>
  
  <pre><code>    @echo off
      setlocal enabledelayedexpansion
  
      rem set lang pre-requisites
      rem Purpose can be 'test' or 'deploy'
      SET purpose="test"
      SET lang="English-India"
      SET lang_code="EnIn"
  
      rem if purpose is test then the folder will be EnInP101M2Tsub, if purpose is deploy then EnInP101M2DFull
      if "%purpose%"=="test"( SET folder=="%lang_code%P101M2Tsub" )
      else if "%purpose%"=="deploy"( SET folder=="%lang_code%P101M2DFull" )
  
      rem set required paths here
      SET audio="C:\Users\Administrator\..path..\%lang%\%purpose%\BGM\M2\%folder%\*.wav"
      SET source="C:\Users\Administrator\Downloads\Matt_Trial\..path..\%lang%\%purpose%\BGM\M2"
      SET target="C:\Users\Administrator\Downloads\Matt_Trial\..path..\%lang%\%purpose%\BGM\M3\*"
  
      rem copying the data
      xcopy  %source% %target% /e /i /h
      rem copying audio files into the other folders
      for /d %%a in (%target%) do copy %audio% "%%a"
  
      rem renaming M3 folders
      cd %target%
      for /d %%a in (*) do (
        set "p=%%a"
        set "fp=!p:~0,8!" &amp; set "tp=!p:~10!"
        ren %%a !fp!M3!tp!
      )
  </code></pre>
  
  <p>** For your Understanding **
  I have 2 folders in my parent folder (M1,M2,M3).
  Step 1: I am copying contents in M2 to a new folder M3.
  Step 2: I need to copy contents of a folder under M2 which has my audio into all the folders in M3.
  Step 3: I rename the folders under M3.</p>
  
  <p>I hope I made myself clear.
  I have to figure out the audio path based on the set variables. I need help with the if condition part. As of now I keep getting The system cannot find the file specified. Please help!!</p>