作者ddd321 (-d)
看板Windows
标题Re: [问题] 如何列出资料夹下所有影片长度
时间Tue Jul 22 17:23:24 2014
把以下内容存成 *.ps1 ,放到影片旁边
对着ps1档按右键 → 用PowerShell执行
win8测过可以,希望 win7也可以
===================================================
$Shell = New-Object -Com "Shell.Application"
dir *.wmv | % {
$File = $Shell.NameSpace($_.DirectoryName).ParseName($_.Name)
$Duration = $File.ExtendedProperty("Duration")
if ($Duration -ne $null ) {
$T = New-TimeSpan -Seconds ($Duration / (1000*1000*10) )
$Time = $T.tostring()
} else {$Time = ""}
"$Time " + $_.name
# 多加的,如果有人需要的话
# $Width = $File.ExtendedProperty("System.Video.FrameWidth")
# $Height = $File.ExtendedProperty("System.Video.FrameHeight")
# WMV之外的影片,系统可能需要装Codec (不确定…)
# 如果副档名给错的话,可能会显示不出来
# 例如,容器是mp4,副档名却用avi
} > 影片时间.txt
ii 影片时间.txt
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 61.230.108.251
※ 文章网址: http://webptt.com/cn.aspx?n=bbs/Windows/M.1406021007.A.052.html
※ 编辑: ddd321 (61.230.108.251), 07/22/2014 17:27:10