Home WindowsScripting Forcing Windows to use Windows Photo Viewer

Forcing Windows to use Windows Photo Viewer

by Tommy Andersen
1 comment

A bit of history

I see it all the time. People install some God-awful image viewer (*cough* Quicktime *cough*) and it overtakes their default image file associations. Annoying. As if image files weren’t already hunted pray. Furthermore we now also have Windows 10 (and to some extend 8 and 8.1) pushing us to use the Metro app: Pictures. Personally I don’t really mind Pictures that much, though I must admit to still using the classic Windows Photo Viewer. I find it a slightly faster when quick-stepping through a bunch of images using the arrow keys – and besides, it seems more clean and simple; which is a good thing.

A while back, long before Windows 10 was even a foggy wet dream at Redmond, I wrote a “reset script” which sets the most common image file types: jpeg/jpg, gif, png and tif/tiff, back to using Windows Photo Viewer. So when a similar issue landed on my desk the other day, I figured that I would take a look at it again and perhaps give it a much needed overhaul.

Addressing the problem

Ignoring completely that we could obviously just set these things from within the Windows GUI. Using ftype and assoc today, we need to take many things into account.

Ye olden days Windows (xp)

Back when everyone was running Windows XP, it was a simply matter og using the ftype and assoc commands to update the registry entries for each file association. Example:

(Note the double %% before the 1, which you need to omit if you run the commands directly from a prompt)

Newer Windows versions

However that obviously wouldn’t suffice for newer version of Windows. And not only due to the fact that the image viewer is different and therefore must be associated differently – but also since there are various things in place, which prevents you from changing the file associations that way (in addition to the obvious elevation concerns). If we simply ignore that however, and just update to script. It would look like this:

Now that may actually be sufficient in certain cases. However, especially looking at Windows 10, there at a number of additional things which you need to take into account.

First of all. If you’re running a clean Windows 10 installation, you won’t even have Windows Photo Viewer available to you until you apply a small fix (Yes, I’m calling it a fix…deal with it).

Secondly, Windows 10 has triggers in place, which will detect if you change the file associations for certain file types in certain ways and reset these back to their default value (which means back to the Pictures app in this case). So in order to avoid that, we wan’t to start by setting a few registry entries BEFORE we change the associations, so that Windows minds it’s own business. To learn a bit more about this problem, you can start be reading this. For now though we simply need to set the following two registry entries. Using the command line methodology from earlier, it can be done as follows.

Then we need to start fresh. The easiest way, I found, was to delete the registry entries for each file association before re-creating them from the command line. So let’s delete them:

And then we can run the script from ealier to associate the extensions correctly.

The completed Windows 10 script

Now looking at the complete script, it should look something like this.

Remember to run it elevated. Enjoy!



You may also like

1 comment

Tommy Andersen 17. June 2019 - 9:56

This has changed a bit in the recent versions of Windows (1803 / 1903) and consequently it no longer works as detailed above. You may still need to do some of the operations – and running the script wont hurt. However you’ll have to set the “Photo viewer” through the Default Apps overview found under Settings.


Leave a Comment