Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Can I get/set file 'Title' information?

1,163 views
Skip to first unread message

Michael Gao

unread,
Jul 9, 2008, 9:13:41 PM7/9/08
to
Hi,
I have a lot of WebCast files like the follows. In explorer, I can seek the
'Title' column and find which I want. Can I get or set 'Title' information
within PowerShell?

-a--- 2007/1/18 12:50 16747465 msft122506vxam.wmv
-a--- 2004/12/29 5:37 89575366 msft122704vx.wmv
-a--- 2007/1/18 12:45 14558112 msft122706vxpm.wmv
-a--- 2004/12/30 11:48 80853128 msft123004vx.wmv

Thanks!
MG

Shay Levy [MVP]

unread,
Jul 10, 2008, 4:31:33 AM7/10/08
to
Hi Michael,

If you can see the title text when you right click a file and look at the
Summary tab > title, then you can get it this way:


$shell = new-object -com shell.application
$folder = $shell.nameSpace("d:\webcast")

dir $folder.self.path -filter *.wmv | foreach {
$item = $folder.parseName($_.name)
$title = $folder.GetDetailsOf($item, 10)
$_ | add-member -p noteproperty Title $title

} | select name,title

I don't know of a way to set it.

---
Shay Levy
Windows PowerShell MVP
blog: http://blogs.microsoft.co.il/blogs/ScriptFanatic

MG> Hi,
MG> I have a lot of WebCast files like the follows. In explorer, I can
MG> seek the
MG> 'Title' column and find which I want. Can I get or set 'Title'
MG> information
MG> within PowerShell?
MG> -a--- 2007/1/18 12:50 16747465 msft122506vxam.wmv
MG> -a--- 2004/12/29 5:37 89575366 msft122704vx.wmv -a---
MG> 2007/1/18 12:45 14558112 msft122706vxpm.wmv -a---
MG> 2004/12/30 11:48 80853128 msft123004vx.wmv
MG>
MG> Thanks!
MG> MG


Alex K. Angelopoulos at

unread,
Jul 10, 2008, 2:45:48 PM7/10/08
to
"Michael Gao" <gaoy...@hotmail.com> wrote in message
news:O9dvyoi4...@TK2MSFTNGP05.phx.gbl...


Shay's method works, and in fact works for any document type. There is no
equivalent for setting data using Shell. Application, but it's possible to
use Windows Media Player to do it from script. Here's a quick example; note
that the name of a media is the same as the Explorer title.

$wmp = new-object -comobject wmplayer.ocx
$media = $wmp.newMedia("D:\Data\Docs\webcast.wmv")
$media.name = "foo"

The metadata gets updated immediately.

Michael Gao

unread,
Jul 10, 2008, 10:49:36 PM7/10/08
to
Thank you very much, Shay. To get these info is enough for me.

MG

"Shay Levy [MVP]" <n...@addre.ss> wrote in message
news:89228ed234e478...@news.microsoft.com...

Michael Gao

unread,
Jul 11, 2008, 3:39:17 AM7/11/08
to
Hi, Shay:
I tried the script and the inforation I got seems 'File Owner' and not the
'Title' in Details tab of wmv file properties.
Name Title
---- -----
msft041905vxpm.wmv <MyComputerName>\<MyUserName>
msft101304vx.wmv <MyComputerName>\<MyUserName>
msft102505vxam.wmv <MyComputerName>\<MyUserName>
msft122104vxam.wmv <MyComputerName>\<MyUserName>
msft122506vxam.wmv <MyComputerName>\<MyUserName>
msft122706vxpm.wmv <MyComputerName>\<MyUserName>

So I think may be the '10' is not for 'Title'. Am I right?
$title = $folder.GetDetailsOf($item, 10)

Thanks for your help.

MG


"Shay Levy [MVP]" <n...@addre.ss> wrote in message
news:89228ed234e478...@news.microsoft.com...

Michael Gao

unread,
Jul 11, 2008, 3:45:37 AM7/11/08
to
Hi,
I got the info in your way. This my last script:
$wmp = New-Object -ComObject wmplayer.ocx
$files = dir D:\webcast\* -Include *.wmv
foreach ($f in $files){
$media = $wmp.newmedia($f)
$media |ft sourceURL, name
}

Thank you very much!
MG

"Alex K. Angelopoulos" <aka(at)mvps.org> wrote in message
news:uAr040r4...@TK2MSFTNGP02.phx.gbl...

Shay Levy [MVP]

unread,
Jul 11, 2008, 6:38:51 AM7/11/08
to

Its 21 on Vista.

---
Shay Levy
Windows PowerShell MVP
blog: http://blogs.microsoft.co.il/blogs/ScriptFanatic

MG> Hi, Shay:
MG> I tried the script and the inforation I got seems 'File Owner' and
MG> not the
MG> 'Title' in Details tab of wmv file properties.
MG> Name Title
MG> ---- -----
MG> msft041905vxpm.wmv
MG> <MyComputerName>\<MyUserName>
MG> msft101304vx.wmv
MG> <MyComputerName>\<MyUserName>
MG> msft102505vxam.wmv
MG> <MyComputerName>\<MyUserName>
MG> msft122104vxam.wmv
MG> <MyComputerName>\<MyUserName>
MG> msft122506vxam.wmv
MG> <MyComputerName>\<MyUserName>
MG> msft122706vxpm.wmv
MG> <MyComputerName>\<MyUserName>
MG> So I think may be the '10' is not for 'Title'. Am I right? $title =
MG> $folder.GetDetailsOf($item, 10)
MG>
MG> Thanks for your help.
MG>
MG> MG
MG>

MG> "Shay Levy [MVP]" <n...@addre.ss> wrote in message

MG> news:89228ed234e478...@news.microsoft.com...
MG>

Joel (Jaykul) Bennett

unread,
Jul 12, 2008, 10:10:03 AM7/12/08
to
You can avoid COM and loading up the whole media player ... and at the
same time get easy access read/write access to these tags using
TagLib# as I detailed on my blog awhile back.
http://huddledmasses.org/editing-media-tags-from-powershell/

TagLib# works with audio *and* video, and gives you access to
everything from bitrates and formats to duration and metadata like
artist, title, album (if there is one), etc. There's an example on my
blog of how to write a filter that just adds all the tags to any media
file so you can do something like:

ls D:\webcast* | Add-MediaInfo | Format-Table Name, MediaTitle,
MediaComment, MediaDuration, CreationTime

--
Joel

0 new messages