If I select multiple files of different types, why does the Open verb disappear?


xpclient notes that if you selected multiple files of different types on Windows XP, you could still Open them all; but starting in Windows Vista, if you select multiple files of different types, then the Open verb disappears. Why is that?

Suppose you selected two files, say, a text file and a JPEG image. You right-click the multiple-file selection and pick Open. The result is that Notepad gets run to open both files. It opens the text file okay, but the JPEG image comes out a mess.

That's because the context menu handler for a multiple-file selection is the handler for the first file in the selection. (You have to pick somebody.) Notepad can handle text files okay, but JPEG files are a bit too much.

xpclient's example involved a selection consisting of a DOC and a DOCX file. This is a lucky break, because if you have Office installed, DOC files are of type Word.Document.8, and the handler for that is Word; meanwhile, DOCX files are of type Word.Document.12, and the handler for that also happens to be Word, so two wrongs make a right, at least in this case.

Windows Vista realized that asking Notepad to open a JPEG image was not the best outcome, so it plays it safe and decides that if the multiple-file selection contains files of multiple types, it will remove the Open verb because the handlers are in conflict; no one handler will be able to handle all the files in the selection. (Well, unless you luck out, as in xpclient's example.)

You could argue that Windows Vista erred too much on the side of caution. It could have looked at the types and said, "Oh, the types are different. But maybe they have the same executable handler; let me look at all the verbs registered for Word.Document.8 and all the verbs registered for Word.Document.12, and for each verb, look up the handlers for each one, and if they match exactly, then allow the verb to be shown on the context menu after all."

Coding up the logic for detecting that two handlers are distinct but equivalent would have been a lot of work for what some would consider an edge case. Minus 100 points, and possibly a science project.

Now, maybe you think that this is a common enough case, selecting multiple files that are technically different types but which coincidentally share the same handler, that the context menu handler for multiple-file selections should go to the extra work of checking each verb to see if it has the same handler for every file in the selection. (And if they don't have the same handler, then invoke two handlers, one for each file. And if the two files have different default verbs, like how media files default to Play, but image files default to Open or Preview, then, um...) You're right, all this could have been done. But that's not how it ended up. Sorry.

Bonus chatter: In the case where the multiple files in the selection do not have equivalent handlers, what do you do? Maybe you invoke a separate handler for each file: Select an image file, a spreadsheet, and a word processor document, right-click them all, and select Print, and run three programs, one to print each one. Now you have to do set theory, showing a verb only if it is available in all handlers. If the user selected a thousand files, that's a lot of handlers, and a lot of set theory, and potentially a lot of disk access. (Context menu handlers are supposed to try to avoid accessing the disk until they are invoked, but in practice they often do; for example, they may want to inspect the file contents to decide which verbs to offer.)

Things also get a bit weird if the file types have conflicting default verbs. For example, music files might default to Add to Playlist, whereas image files default to Preview. Both have an Open, though. So you get into the weird state where if you select a bunch of music files and hit Enter, then they all get added to your playlist. But if you accidentally included the album art file in your selection, then they all get Opened, and you get all the songs in your album playing simultaneously. Not sure how to fix that.

Comments (27)
  1. skSdnW says:

    You do have the PerceivedType and Kind properties that could at least tell you if they are all images etc.

    Its cases like these that makes me wish Windows had one extra step of indirection so when a program declares it knows how to open .jpg files it also has to specify what this action does (view/edit/play/print) then the context menu could display one or more canonical actions at the top of the list:

    View (Foo)
    Edit (Paint)
    ---
    Open with> Foo editor, Bar editor, Paint, Baz viewer
    ---
    Cut
    Copy
    ...

    Over time the shell team has tried to move in this direction but they never took the step to really separate canonical verbs and application specific handlers so the "open" verb has stayed as the general dumping ground for most things.

  2. EduardoS says:

    I don't remember the last time I had to select multiple files of different type and press enter, if I ever had to do it, but if I had to, I would like the command causing each to do it's default action (verb).

    But to implement that, I think "verbs" as they are aren't the best way to define what the user actually wants.

    1. Kirby FC says:

      Selecting several different .DOC and .DOCX files makes sense because I would just automatically assume they're both going to be handled by Word. But before reading this article, mixing completely different types (,txt and .jpg, etc) would never even occur to me - that's just weird.

      1. EMB says:

        Maybe makes sense when you are mixing .DOC, .PDF and .TXT that are all text like files, like when you are reading documentation that is spread on few different types. But as Raymond says, it is difficult to work with this.

  3. Juan says:

    For me this is an example of how a technical problem got collapsed into itself and entertained the engineering team of how difficult it is. Obviously the shell already *knows* when multiple files are selected to hide the Open verb. I would, as a user, expect to open all handlers separately and evaluate the default verb separately. For Word and Excel doesn't make much difference since all docs open in different windows. For music files "Add to play list" as a default verb then would add them and, yes it would open the album art separately if you had it in a different file and do not comes in the MP3 Tag as nowadays happens to happen.

    Slag comment: OS X does that. This is one of the thousand drops that makes the cup overflow and makes you go to the apple store to get your Mac. But you always will have Office while you listen to users and see their point for things. That's how I ended up. Sorry.

    1. voo says:

      So Mac OS creates a thousand processes when I accidentally touch enter when having selected a thousand files (probably to move them somewhere)? Yeah.. that sounds totally awesome.

      Oh you mean that's just a different trade-off and you prefer that one compared to the other? Good for you, although I'm wondering what weird use case you have where you regularly want to open different files at the same time.

      1. Nico says:

        The issue of selecting a thousand files is an entirely separate problem. Windows had the same problem in the past, but now it usually asks you before opening a lot of selected files at once.

        I agree with Juan. This is not a difficult or challenging problem when you look at it from a user's point of view OR an engineering standpoint. For each item selected, invoke the default verb. If different kinds of files are selected, then different kinds of actions will happen. Maybe it sounds weird, but that's what the user *wanted* to happen.

        1. Blind opening is the easy case. The more general case is "What do you put on the context menu for a mixed selection?" Do you create 1000 context menu handlers and do set intersection across all of them to get the common list of verbs? And what if the verbs have different display names? E.g., The "open" verb for text files is called "Open" but the "open" verb for *.maw files is "Browse". Do you consider that a successful intersection, or do you consider them distinct verbs even though the programmatic name is "open" for both?

          1. Juan says:

            Raymond. Again. Too complicated. Just "Open multiple files" would do. Simple.

          2. @Juan So you're saying that if you right-click a group of files, the only thing on the context menu should be "Open multiple files" and nothing else? If you select 10 Word documents and right-click, there's no "Print" option. If you select 10 mp3 file and right-click, there's no "Add to playlist"? Does this mean that if you right-click one *.maw file, you get "Browse", but if you right-click two, you get "Open multiple files"?

          3. Cube 8 says:

            "Open multiple files" should only be shown only if the selection contains multiple file types.
            If all files are of the same type, there is nothing special to be done; just show the menu options for that file type.

          4. Juan says:

            Hi Raymond,

            Sorry for the delay. Here in Ireland we have a different time zone. I think you might have lost perspective of what a user *naturally* would expect and then technical questions. There are a lot of common properties between files. After all they all are files though from different types. So "Properties", "Open Multiple Files" as opposed to hide the open menu and then executing the default verb in each of them, "Send to email", since people still mail files nowadays, copy, cut, and so on would be no issues for that.

            Just to mention an example. Notepad++ shell extension opens multiple selected files in different tabs when selected. The team at Office must have an idea too since you can have multiple selection and do common task in them, format excel columns, format non continous text and graphics...

            Again as a user that knows nothing about COM or even computers I would expect each file to be treated as if I double clicked in it individually and if I right click and then select "open multiple files" it seems pretty intentional to me.

    2. John Doe says:

      I'm running to the store right now to have a file explorer that crashes easily, that hangs on network or any slow resources even more easily and implies killing or having every window non-responsive when it happens.

      Wow, look how beautiful that spinning thing is, and how often it shows up... Oops, there goes that nosy app again, haha! What a joy it is to use this machine!

      Ah, say what? It can also happen on any application on the open file dialog? Whoohoo!

  4. DWalker says:

    I rarely open more than one file at a time by selecting the files and pressing Enter. Still, if I select two Excel files and two Word files, and press Enter, then I probably want them each to open in their respective programs.

    If you do this with music files, and several songs start playing at the same time, so what? You will learn not to do this. :-)

  5. IanBoyd says:

    I just tested it. It looks like in Windows 7 the shell removes the **Open** verb once if you select more than 15 files. If you select 16 files, the **Open** option disappears, and **Print** because the default context menu option.

  6. Joshua says:

    Now Windows 95 had yet different behavior. If you selected multiple files and pressed enter (I don't recall what was in the right-click handler), each would open no matter what the types. I'm convinced that for each file it looked up the default verb and applied it.

  7. HiTechHiTouch says:

    @Joshua -- As it should still be. For I=1 to selections.0 DO open selections.I

    -90 points to the feature score for removing function and adding code for specific cases.

  8. The MAZZTer says:

    Really, the best "fix" is to give files that all serve the same function (eg, Videos, Images...) and are all handled by the same application the same file type, so then they can all use the same handler and this problem doesn't happen.

    In xpclient's example, that would be assigning DOC and DOCX files the same type. Because nobody really cares about grouping DOC and DOCX files separately in Explorer in real life; they just see Word Documents. Though I am sure the Office team has to keep them separate for some other reason.

    In general, I assume most people don't care about the differences between JPG, and PNG, or GIF and GIFV (eg renamed MP4 without sound), AVI and MP4, WAV and MP3. If it's that important you probably have file extensions showing anyway. I personally have all my media files in manually created "Audio" and "Video" file types, set to open with my app of choice.

    1. The MAZZTer says:

      Forgot to add that, of course, this is the responsibility of the application developer to make sure all associated file types map to a single Shell file type when appropriate.

    2. cheong00 says:

      Consider the default scenario where there are no Office (or alternatives) installed, WordPad only open DOC in WinXP and only open DOCX on Win7+. Not sure about Vista. (I tried to open DOC in Win7 WordPad and it simply freeze there, and then a minute or so later it opens content as garbage characters)

  9. BZ says:

    I really do want to yell and scream about how this is unacceptable and should open each file in its own application, but considering I had no idea what the behavior is or that it even changed, despite using Windows for 23 years now, I guess it really is an edge case. I don't recall ever trying to open multiple files except by accident.

  10. Mihailik says:

    Indeed! It's hard to imagine a computer doing set theory — all these unions and intersections would stretch the mightiest of data buses to the limit.

    I bet it's almost as tough on computer's gentle CPU as bit shifting!

    1. Set theory isn't the problem. The problems is building 1000 context menus, especially if the files are on a server on another continent. The problem is dealing with programmatic names vs UI names (and what if they don't match)?

      1. I wonder if you could pre-emptively load the context menus as the additional file types are loaded... sure, some verbs are complex (XML files that open in infopath vs whatever-else) and may involve reading the file (which is even worse if the file is offline in some 5th tier storage, and the verb isn't respecting the rules for offline files).

        Perhaps it's possible to determine whether verbs are simple or complex, and pre-emptively load (from registry) when simple?

      2. cheong00 says:

        On the other hand, people who really need to open 1000+ files of different type can write their own program that loops through the argument to call ShellExecute on each of them, and then place to shortcut of it named "Open Everything" to SendTo folder (enter shell:sendto in Explorer)

        Now you can open all files by selecting them, then right-click -> Send To -> Open Everything, and see how well it goes.

  11. Erkin Alp Güney says:

    Media players handle still images fine.

Comments are closed.

Skip to main content