Code: Select all
wt.exe -- powershell.exe -NoExit -NoLogo -File "D:\iso to mkv.ps1" source-file output-folder
Code: Select all
$MakeMkvCon64 = 'C:\Program Files (x86)\MakeMKV\makemkvcon64.exe'
$output = & $MakeMkvCon64 -r info "iso:$($args[0])"
$titles = $output -match 'TINFO:\d+,\d+,\d+,"\d+:\d+:\d+"'
$titles = $titles | foreach {
$_ -match 'TINFO:(\d+),\d+,\d+,"(\d+):(\d+):(\d+)"' | Out-Null
[PSCustomObject]@{
Title = $matches.1
Duration = New-Object TimeSpan -ArgumentList $matches.2,$matches.3,$matches.4
}
}
$titles = $titles | sort Duration -Descending
$longestTitle = $titles[0].Title
$outputFolder = $args[1]
$source = "iso:$($args[0])"
& $MakeMkvCon64 --progress=-stdout mkv $source $longestTitle $outputFolder