shellproperty.exe – set/read string properties on a file from the command line


Yesterday Raymond Chen blogged a “Little Program” which could edit audio metadata. As it happens, I have a similar tool I threw together which accepts a property key and a string property value to update a property, or can read a string or string-vector property.

Usage:

>shellproperty
shellproperty read <key> from <filename>
shellproperty set <key> to <string> on <filename>

Here’s an example _fixup.bat script I use to set audio metadata on my copy of Giuseppe Sinopoli’s recording of Madama Butterfly, to help distinguish it from other recordings of the same opera that I have.

@echo off
dir /s /b “I *.mp3” | xargs /addquotes shellproperty set PKEY_Music_AlbumTitle to “Madama Butterfly – Sinopoli / Freni: 1 of 3” on
dir /s /b “II *.mp3” | xargs /addquotes shellproperty set PKEY_Music_AlbumTitle to “Madama Butterfly – Sinopoli / Freni: 2 of 3” on
dir /s /b “III *.mp3” | xargs /addquotes shellproperty set PKEY_Music_AlbumTitle to “Madama Butterfly – Sinopoli / Freni: 3 of 3” on

Source and amd64/x86 binaries attached, but in substance it’s very similar to Raymond’s “Little Program”.

Possible future improvements:

  1. When setting, allow specifying a vartype on the command line.
  2. Allow specifying a property key by fmtid and pid.
  3. Handle more vartypes for displaying properties.
  4. Allow dumping all properties on a given file.

EDIT September 22 2015: removed source and binaries as this is obsoleted by http://blogs.msdn.com/b/matthew_van_eerde/archive/2013/09/24/shellproperty-exe-v2-read-all-properties-on-a-file-set-properties-of-certain-non-vt-lpwstr-types.aspx

Comments (2)

  1. skSdnW says:

    Why hardcode PKEY strings when you can just use PSGetPropertyKeyFromName? It will even handle {fmtid},pid…