Libraries are my favorite feature of Windows 7. I have been waiting for this type of functionality for about 5 years now to solve a problem with music files on my computer. My wife and I store music on the same machine, but not all of our collection is shared. There are at least three reasons. First, quite obvisouly our musical tastes aren’t identical. Second, my wife is a dance teacher and some of her music is geared toward ballet excercises. Finally, she owns and iPod and I chose a Zune and the two devices don’t play protected music from each other’s services. Before Windows 7 we effectively had to store two separate copies of each song which we shared. In Windows 7 I could simply set up each of our music libraries to contain a folder with private music and another folder with the music we share. Thanks to each library’s ability to display an aggregated view of files from all contained folders, arrange it by common properties (such as artist or genre), and search by any properties, we can now conveniently organize our music. In addition, this view of our music is shared by Windows Explorer, Windows Media Player, and Windows Media Player Network Service, which can stream media to compatible devices, such as Xbox 360. For more information about configuring media streaming refer to my soon to be available post on the subject.
The out-of-the box library functionality is quite flexible and probably sufficient for many folks, but because I am a pendantic person and like to have things my way I had to resort to a few tweaks to make my libraries work just right. The rest of this post describes my configuration, offers some tips and tricks, and lists certain limitations that I encountered. I got my introduction from a post on The Windows Blog. There are also a handful of introductory videos on MSDN Channel 9 on this topic (Find and Organize – Part 1, Empower Users with Libraries, and Find and Organize – Part 2)
First, my configuration. I like to keep my data separate from the operating system as much as possible, so I store all my media and documents on a different hard drive. This allows me to periodically wipe out the system drive and install the system from scratch, without worrying about my data. On that data drive (H: in my case) I have a folder for my wife’s music (H:\Heather\Media\Music) and my own music (H:\Andrew\Media\Music). I also have one folder for shared music (H:\Shared\Media\Music) and one more for my Zune subscription music (H:\Andrew\Media\Zune\Audio).
I started up by setting up separate Windows accounts for myself and my wife. Each account’s Music library comes preconfigured to include that user’s “My Music” folder. In my case, I needed to move each user’s “My Music” folder from its default location (C:\Users\<Username>\Music) to the corresponding location on the data drive. It turns out that Explorer (finally) offers a straightforward way to achieve this. You simply need to open a user profile folder (easily accessible from the Start Menu), select “My Music” folder as shown in the picture below and open up the properties of that folder.
In the properties dialog box you can find a “Location” tab (see below), which contains a “Move…” button. Clicking the button opens another dialog box in which you can conveniently type a desired new location for your “My Music” folder. Once you do this you will be asked if you want to move the content of the current folder to the new one. I recommend that you do that because otherwise Windows will simply abandon your original “My Music” folder, and you will see two “My Music” folders under your profile, which is utterly confusing.
I owe you a word of caution here. It appears that if any of your libaries includes a folder on a non-system drive, that drive must be connected for Explorer to work correctly. If you shut down your machine, remove the drive, and restart, you will no longer be able to open any Explorer windows. If you try to start Explorer, instead of the expected folder view, you will experience a small delay followed by a ominous error message “Server execution failed.” The only way to recover is to reconnect the driver or perhaps edit the offending library file. That is certainly an inconvenience and I would hope Explorer would be more resilient in this situation.
Having taken care of mine and my wife’s “My Music” folders, I know needed to add the shared music folder to both our libraries. Adding a folder is easily accomplished by browsing to the desired folder and clicking “Include in Library” toolbar button. After you do this and chose the target library, the library will display items from your folder. If you previously chose to share your libraries with the HomeGroup you may be asked if you want to share the newly added folder. I will devote a separate post to the subject of library and folder sharing a little later.
Now, when you expand the library in the left Explorer bar, you will see the newly added folder. The name shown in the Explorer bar is the name of the folder. But what if that name is not particularly descriptive? In my case the folder containing shared music is simply called “Music” because it already resides in a folder called “Shared”. What if I wanted it to show as “Shared Music” in my library? Well, it turns out that libraries don’t offer a mechanism for aliasing folder names, which I think is unfortunate. You are left with two options. First, you can rename the actual folder. Second, you can trick Explorer by including a hidden Desktop.ini file in your folder. I chose the latter.
To make this approach work you can copy Desktop.ini from your “My Music” folder and alter the first line to make the whole thing look as follows. The added bonus of doing so is that your folder will display with the musical note icon instead of the generic one, much like your “My Music” folder.
[.ShellClassInfo]
LocalizedResourceName=Shared Music
InfoTip=@%SystemRoot%\system32\shell32.dll,-12689
IconResource=%SystemRoot%\system32\imageres.dll,-108
IconFile=%SystemRoot%\system32\shell32.dll
IconIndex=-237
Note also that in order for Explorer to use your Desktop.ini file, the folder that contains it must be marked as read-only. This restriction applies to that folder only, and has no impact on the files and folders contained within. To apply the read-only attribute to a folder use the attrib command from the command prompt as follows.
attrib +r <Folder Name>
I applied this trick to both my shared music and my Zune audio folder, which made Explorer display my Music Library as shown in the picture below.
Intrigued by the apparent lack of aliasing and curious as to why certain folders displayed with the drive letter and others didn’t I decided to delve a bit deeper. The Libraries Under the Hood post on The Windows Blog indicates that libraries are described in XML files with library-ms extension and located in %AppData%\Roaming\Microsoft\Windows\Libraries. The post also gives an overview of the library file schema. The complete schema (with a typically laconic description) can be found in Library Description Schema article on MSDN. A brief look at the schema confirms that there indeed isn’t any means of aliasing a folder name directly in the library. A second look reveals that the actual library locations are stored in a serialized base-64 encoded form. This is unfortunate because it effectively prevents the user from editing the file directly. I’m actually curious what the content of that string is and I’ll have to decode it to take a peek.
Armed with this knowledge I decided to do a little forensic investigation on my own library files. In fact, I looked at them several times while I was adding folders to my own and my wife’s Music Libraries. In the process, I observed that the <url> element of the <simpleLocation>element takes one of three forms a) absolute local path (e.g. H:\Shared\Media\Music), b) network path (e.g. \\MyComputer\Shared Music), or c) known folder reference (e.g. knownfolder:{FDD39AD0-238F-46AF-ADB4-6C85480369C7}). Curiously enough, exactly which form is chosen seems to be arbitrary. I’d love to learn what algorithm is used to determine which form is stored, and whether it has any impact on how the location is accessed by the library.
One final note about the library files. If you manipulate them by hand, be sure to bump the value of the <version> element. This prompts the interested applications (e.g. Explorer or Windows Media Player) to pick up your changes.
I’ll end with a few remarks about certain shortcomings or potential improvements of the libraries feature.
Because libraries are a brand new feature in Windows 7, not all applications know how to take advantage of them. Even Microsoft’s own products don’t always support them. Zune software, for one, doesn’t allow me to choose a library as a location to monitor for music files. Instead, I had to explicitly add all folders contained in the library.
Once you set up your libraries, you will notice that they can be conveniently arranged by certain commonly used properties, such artist or album for music files. The default settings are useful enough, but it would be even better if the list could be extended to other properties that are indexed by the Windows Indexing Service. For example, if you enjoy classical music, the performing artist may not be the most relevant attribute of the files in your collection, and you may want to arrange your library by composer, instead. Unfortunately, that is not possible (at least from the Explorer). There may be a registry setting somewhere, but I haven’t found one so far.
When I relocated my personal music folders to my data drive, I considered moving the public folders there also and using them as the location for my shared media. It turned that the matter is more complicated than with personal libraries. First, Explorer doesn’t provide a convenient Location tab in its Property pages where you could enter a new target path. You can work around this by tweaking the registry, but with one caveat described shortly. Under the registry key “HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders” you can find entries for all your libraries (e.g. CommonMusic). You change the path for any of them to effectively move the library to a different folder. Incidentally, there is a different key called “Shell Folders” under the same path, which presumably stores the system default paths, in case you’d like to restore them. Now, the caveat. After I used this method to reloacte my public music library, I observed an incosistent behavior between Explorer and Windows Media Player. When I opened my music library dialog box in Explorer, it would show the correct path to my shared music, which was also the location of the public music folder. On the other hand, Windows Media Player continued to display the original location (C:\Users\Public\Music). It also appeared as though the original folder kept getting recreated when I restarted the machine. I found this very confounding and ultimately decided to reset the public folders to their defaults.
I suspect this strange behavior is the result of the known folder settings in the registry under “HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\Folder Descriptions”. After digging around a bit I located the CommonMusic folder and noticed that it has a Parent entry along with a RelativePath entry. The Parent value points to another known folder called Public, which by default is located at “C:\Users\Public”, and the RelativePath is set to “Music”. So if the CommonMusic is moved to a new location (in my case “H:\Shared\Media\Music”) some ambiguity arises. An application can take the path from CommonMusic under “User Shell Folders”, or it can construct it by taking the loaction of the Public known folder and appending the relative path from the CommonMusic known folder, thus obtaining “C:\Users\Public\Music”. In addition, there is a PreCreate value under the CommonMusic known folder. It’s value is set to 1, which may explain why the original folder kept reappearing after restart. The per-user known folders, such as “My Music” don’t have the Parent value, which is probably why they can be moved safely and don’t lead to this confusion.
All in all, I find libraries to be a very welcome and useful feature, but there still remain some wrinkles to be ironed out.


