@echo off
rem ------------------------------Read me--------------------------------------
rem Revision : 1.0.5
rem     Date : 2012-09-30
rem  Created : 2012-05-19
rem    Usage : Create _Periods.ini file run the Batch
rem Read from _Periods.ini configuration files in the clip time
rem # D:\path\file.avi         <--- # Remark
rem D:\path\file.avi           <--- input file name
rem n0519                      <--- output file name head
rem avi                        <--- output file extension 
rem 00:01:30.000 00:01:40.000  <--- clip time 1
rem 00:02:30.000 00:02:40.000  <--- clip time 2
rem ------------------------------Start the conversion-------------------------
setlocal enabledelayedexpansion
echo @echo off>zCmd_tmp.bat
set /a count=0
rem Directory or file name contains an ! exclamation point problem
for /f "eol=# delims=" %%i in (_Periods.ini) do (
    set /a count=!count!+1
	if !count! EQU 1 (set ifn="%%i")
	if !count! EQU 2 (set ofn=%%i)
	if !count! EQU 3 (set extn=%%i
		set mCmd=call Lib_Conversion !ifn! !ofn! !extn!)
	if !count! GEQ 4 (
        set /a newindex=!count!-3
		if !newindex! LEQ 9 (set index=0!newindex!) else (set index=!newindex!)
		set _time=%%i
		rem echo !mCmd! !_time:~0,12! !_time:~13,12! !index!
		echo !mCmd! !_time:~0,12! !_time:~13,12! !index!>>zCmd_tmp.bat ))
setlocal disabledelayedexpansion
call zCmd_tmp.bat
del zCmd_tmp.bat
rem ------------------------------clear tmp var--------------------------------
set count=
set _time=
set newindex=
set index=
set mCmd=
set ifn=
set ofn=
set extn=
rem ------------------------------Start the join-------------------------------
rem call Lib_Join
echo **** All clips finished! ****
pause>nul
@echo on