Searh specific Value in filename with Batch File

March 15, 2012 at 16:58:19
Specs: Windows 7
hello guys

i'am trying to encode my audio file(*.mp2) with batch file..

The problem is every audio has different DELAY..

For Example :

Audio1 1 PID 0c9 L2 2ch 48 256 DELAY 96ms.mp2
Audio2 1 PID 0c9 L2 2ch 48 256 DELAY 72ms.mp2

As you can see audio1 need to be encode with +96ms delay and audio2 +72ms

How can i dedect that value(96 or 72) and add this value automaticly in my batch file?

Here is my code for encode any .mp2 in folder

set eac3to=D:\eac3to\eac3to.exe

for /R %%A in (*.ts) do IF NOT EXIST "%~1%%~pnA.mp2" "%eac3to%" "%~1%%~pnxA" "%~1%%~pnA.mp2" +96ms

I added myself that +96ms everytime.. I Need to dedect and add automaticly..

Any ideas ??


See More: Searh specific Value in filename with Batch File

Report •


#1
March 15, 2012 at 19:57:24
Try this for 1 to 3 digits of delay (assumes the rest of your filespec is standardized in length as you seem to imply here):

setlocal enabledelayedexpansion
for %%i in (*.mp2) do (
  set filespec=%%i
  set delay=!filespec:~37,9!
  set delay=!delay:~0,-6!
  echo filespec=!filespec!  delay=!delay!
  )
endlocal


Report •
Related Solutions


Ask Question