Why can’t I pin a document to the taskbar?

Raymond Chen

Sven2 wonders why the taskbar won’t let you pin a batch file or a shortcut to a log file.

The idea behind pinning an item to the taskbar is that it represents something that isn’t running on the taskbar right now, but when you click the pinned item, it turns into a real item in the taskbar.

And items on the taskbar are identified by their application user model ID. We saw earlier how you can set a custom application user model ID on your window to make it group differently. Perhaps because you have two executables that work together and you want them to be treated as one giant logical application. Or perhaps because you have one executable that represents multiple logical applications.

Okay, now we’re getting closer to the issue.

Batch files and documents are not logical applications. They are things that get opened by applications. Batch files, for example, are opened by the cmd.exe application. When you open two command prompts, the two command prompt windows are grouped together. If you run a batch file in one of the command prompts, the command prompt does not unsplit from its sibling and become a separate group. It’s still the “command prompt” application; it’s just doing something different right now.

Similarly, if you have two Notepad windows open, and then you tell one of them to open a log file, it does not unsplit from its sibling to become “The log file application”.

Suppose that you could pin batch files and log files to the taskbar. How should they group with other command prompts and Notepads? (In other words, what would the application user model ID for the pinned item be?)

If the pinned batch file has its own application user model ID, then when you clicked the pinned item and the batch file ran, the resulting batch file window would not be grouped with the icon on the taskbar, the resulting batch file window is running with cmd.exe‘s application user model ID. You would have two icons for the batch file: A ghost that represents a launcher for the batch file, and then the actual batch file.

On the other hand, if the pinned batch file used cmd.exe‘s application user model ID, then all command prompts would get grouped together with your batch file icon, since your batch file icon says “I am cmd.exe!”

It sounds like what you really want is a quick way to launch a batch file. And we already have that. it’s called Quick Launch.


Discussion is closed.

Feedback usabilla icon