Get Video Duration with PowerShell (No FFmpeg Needed)

Read a video file's Length property through the built-in Shell.Application COM object.

WindowsvideocompowershellLow risk
Use Shell.Application Namespace + ParseName on the video, then GetDetailsOf with the Length column index (usually 27).

01Command

Command
$ $sh=New-Object -ComObject Shell.Application; $f=$sh.Namespace('C:\Videos'); $v=$f.ParseName('clip.mp4'); $f.GetDetailsOf($v,27)

02What it does

Explorer shows Length, frame width/height and bit rate for every video, and all of it is available through the Windows Property System — no media tooling required. Column 27 is Length on most Windows 10/11 builds, but verify by scanning all columns on one file first. Combine with Get-ChildItem in a loop to get durations for an entire folder of clips.

03Risk

RiskLow risk
RequirementsIndex of the Length column varies by Windows version; run the full GetDetailsOf scan first to find the right index
!Warning: The Length column index differs between Windows versions and locales; verify the index before scripting against it.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • System.Media.Duration
    Microsoft Learn · vendor-doc · 2026-09-17
    Evidence: Defines the media duration property in 100ns units that Windows Explorer reads for video/audio files — the value GetDetailsOf exposes as a human-readable length.
  • FolderItem object (Shell)
    Microsoft Learn · vendor-doc · 2026-09-17
    Evidence: Documents Folder.ParseName / Folder.GetDetailsOf, the COM surface used to read a specific metadata column for a file.

Last verified: 2026-09-17 · Category: Media

06Related solutions