Created
June 23, 2012 20:53
-
-
Save devhawk/2979933 to your computer and use it in GitHub Desktop.
get-bitrate powershell function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function get-bitrate( $file) { | |
| $shell = New-Object -ComObject Shell.Application | |
| $dir = $shell.NameSpace($file.Directory.FullName) | |
| $fileObj = $dir.parseName($file.Name) | |
| $bitrateAttribute = 0 | |
| for( $index = 5; -not $bitrateAttribute; ++$index ) { | |
| $name = $directoryObject.GetDetailsOf( $dir.Items, $index ) | |
| if( $name -eq 'Bit rate' ) { $bitrateAttribute = $index } | |
| } | |
| $dir.GetDetailsOf( $fileObj, $bitrateAttribute ) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Line 8 required a change for this to work. Additionally, the file parameter required a Get-ChildItem call
Line 8 change from:
Line 8 changed to: