1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| @echo off
Title Get Duration of Media Files (mp3,mp4,mkv,mpg,avi etc...) by Hackoo 2018
Set "VBSFile=%Temp%\%~n0.vbs"
Set "Ext=mkv"
Set "Folder=C:\Users\Hackoo\Downloads\Video\"
Setlocal enabledelayedexpansion
for /R "%Folder%" %%F in (*.%Ext%) do (
Set "FileName=%%~nxF"
Call :GetDuration "!FileName!"
echo "!FileName!" =====^> Duration = !Duration!
)
pause>nul & Exit
::******************************************************************************
:GetDuration <FileName> <Duration>
(
echo MediaFile = "%~1"
echo Const LENGTH = 27 ' Windows Vista+
echo 'Const LENGTH = 21 ' Windows XP
echo Dim oShell : Set oShell = CreateObject^("Shell.Application"^)
echo Dim oFolder : Set oFolder = oShell.Namespace^("%Folder%"^)
echo Dim oFile : Set oFile = oFolder.ParseName^(MediaFile^)
echo Dim strLength : strLength = oFolder.GetDetailsOf^(oFile,LENGTH^)
echo wscript.stdout.Write strLength
)>"%VBSFile%"
For /f "delims=" %%a in ('Cscript //nologo "%VBSFile%"') do (
Set "Duration=%%a"
)
Exit /b
::****************************************************************************** |
Partager