The goal is to get .jpg, .png, .tif, and .raw files to always open with Photoshop CC 2015 and use their appropriate icons.
You can refer to the flowchart below about how Windows 10 chooses an icon for a file. I came up with this by making changes in the registry and observing the results.
Problems
- If an extension is associated with a file type, the default icon defined by the extension key is ignored.
- The file type defined by the
UserChoice
keyProgId
value overrides the file type defined by the extension key. UserChoice
keyProgId
value is set toApplication/Photoshop.exe
when setting Photoshop as the always-open-with app for .jpg and .png.- Can't change
UserChoice
keyProgId
value because of new hash security - Can't remove
UserChoice
key for protected extensions like .jpg and .png
Questions/Possible Solutions
- Is there a way to override the icon defined by a file type on the extension level?
- Is there a way to override the file type defined by a
UserChoice
key on the extension level? - What determines what the
UserChoice
keyProgId
value will be set to when setting the always-open-with app in the GUI and why does .tif result inPhotoshop.TIFFFile.90
while .png and .jpg result inApplication/Photoshop.exe
? - Is there a way to generate the hash required on the
UserChoice
key? - Is there a way to stop Windows from checking/requiring the
UserChoice
key hash? - Is there a way to specify a file type like
Photoshop.JPEGFile.90
as the always-open-with app using the GUI? - Is there a way to stop Windows from protecting/recreating the
UserChoice
keys?
Notes
Registry changes wont take effect until explorer.exe is restarted/refreshed. You can use Task Manager to kill and restart explorer.exe, or you can use DesktopRefresh.exe.
The UserChoice
key can exist in two places:
HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\UserChoice
HKCU\SOFTWARE\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpg\UserChoice
If one does not exist, the other is used. So make sure to delete/modify them both if you want to make a change.
Example Keys:
- extension key:
HKCR\.jpg
- file type key:
HKCR\Photoshop.JPEGFile.90
UserChoice
key:HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\UserChoice
Details
When Photoshop first installed, it associated all the file extensions and everything was great. At some point I decided I wanted to always open .png, .jpg, .tif, and .raw files with the Photos app. So I: right-click a .png/.jpg/.tif/.raw file -> Open with -> Choose another app -> Select Photos -> Check "Always open .png files with this app". Now I want to go back to opening with Photoshop. I did the same as before expect chose Photoshop as the app to always use. Now .jpg, .png, .tif, and .raw files open with Photoshop. However, .tif files show the correct icon but .jpg, .png, and .raw show the Photoshop.exe icon.
I tried reinstalling Photoshop but that did not help. I tried using Adobe Bridge to reset the File Associations but that did not help either. Tools like File Types Manager and Default Program Editor do not work (I'll explain why below).
Then I started looking into how Windows 10 chooses which icon to show for a given file. I learned:
- If the extension is associated with a file type, the icon defined by that file type key is used. Otherwise, the icon defined by the extension key is used.
- An extension can be associated with a file type two ways: If an always-open-with program/app has been set for an extension, then the program/app is used as the file type for the extension. Otherwise, a file type can be defined by the extension key.
In my case, .jpg, .png, .tif, .raw have Photoshop set as the always-open-with app. This is reflected in the registry via the
HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\UserChoice
HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\UserChoice
HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\UserChoice
HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.raw\UserChoice
keys. This is where the difference between .tif and .jpg/.png/.raw shows. .tif has a ProgId
value of Photoshop.TIFFFile.90
while .jpg, .png, and .raw have Applications\Photoshop.exe
. This means that .tif is correctly associated with the Photoshop.TIFFFile.90
file type but .jpg .png, and .raw are associated with the file type Applications\Photoshop.exe
.
I can't simply change the icon for the Applications\Photoshop.exe
file type because .jpg, .png, and .raw all use that file type. Therefore, the same icon is used by the 3 extensions. I can't specify a unique icon for each extension. This is why the File Types Manager and Default Program Editor tools don't work. They set the DefaultIcon for the file type in this case.
The solution seemed simple: change the ProgId
value in the UserChoice
keys to use the Photoshop.JPEGFile.90
, Photoshop.PNGFile.90
, and Photoshop.RAWFile.90
file types. This is not possible in Windows 10 anymore. A new security measure adds the Hash
value which accompanies the ProgId
value in the UserChoice
key. Only Windows knows how to generate this hash. If the hash is not correct for the ProgId
value, Windows resets/removes the UserChoice
key. This makes it so this value can only be set via the Windows GUI. The idea is to prevent viruses/attackers from being able to programmatically change the always-open-with app for extensions.
I have no idea why selecting Photoshop as the always-open-with app resulted in the correct ProgId
being set for .tif but not for .jpg, .png, and .raw, but it does not seem possible to fix. At this point, I started looking at other extensions that I had not touched like .tga. I never set a always-open-with app for .tga, so it did not have a UserChoice
key. Instead, .tga's extension key defined the associated type like so:
[HKCR\.tga]
@="Photoshop.TGAFile.90"
Another seemingly simple solution: Unset the always-open-with app by removing the UserChoice
keys and define the file type on the extension keys. This worked for .raw, but not .jpg and .png. When I removed the UserChoice
keys for .jpg and .png I got a Windows notification with this error:
An app default was reset
An app caused a problem with the default app setting for .jpg files, so it was reset to Photos
I refreshed the registry and, sure enough, the UserChoice
key was back. It turns out that Windows protects some extensions (like .jpg and .png) and it does not let you remove the UserChoice
key.
So we can't remove the UserChoice
key, we can't update UserChoice.ProgId
to the correct value, and we can't override the file type specified by UserChoice.ProgId
… what now?
Best Answer
I figured out a hacky workaround, but I would still like to get the answers to my questions above so we can find a proper/less hacky solution.
Beginner-friendly step-by-step below.
Create a dummy .cmd file and set it as the always-open-with app for an extension using the GUI. This causes Windows to create a new file type for the dummy .cmd "app" and associate it with the extension by setting the
UserChoice
keyProdId
value (ex:Application/customJPEG.cmd
). Repeat this process for each extension using a uniquely named dummy .cmd file and, bam, we have unique file types associated with each extension (ex:Application/customJPEG.cmd
,Application/customPNG.cmd
, etc.). We can then customize the icon and open/edit commands independently for each new file type.See my flowcart in the original question for more information about how Windows chooses the icon for a file.
Note: This workaround is only required for protected extensions like .jpg and .png. See my question above for solutions to non-protected extensions. However, this workaround should work for any extension regardless.
Quick vocab:
Note: Image file extensions like .jpg and .png show thumbnails of the image. To see the icon, either create an empty file (so a thumbnail can't be generated) or open an Explorer window and set the View to Details.
Note: You won't see anything change until you refresh the desktop. Make sure to do this after making changes to the registry. See step 6 for details.
Note: If a key seems to be missing in the registry, try refreshing by pressing F5 or View->Refresh. regedit does not stay up to date and requires a refresh to see the latest.
Repeat the steps below for each file extension. Replace .jpg with your file extension and Photoshop with whatever app you want.
1. Create a dummy .cmd file
customJEPG.cmd
as the filename and saveIt doesn't matter where you save it or what you name it expect the name must be different for each file type. The name of the dummy .cmd will determine the name of the file type. I recommend including the extension or file type in the name so it is easy to distinguish later.
2. Set the dummy .cmd file as the always-open-with app
If you want multiple file extensions to share the same file type, repeat steps 1-7 above for each extension.
3. Get the new associated file type
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\UserChoice
ProgId
. This is the file type that is now associated with the .jpg extensionThe file type should be
Applications\{the name of your dummy .cmd}
. Example:Applications\customJPEG.cmd
.4. Update the file type to use the correct icon
HKEY_CLASSES_ROOT\
Applications\customJEPG.cmd
, You will open:HKEY_CLASSES_ROOT\Applications\customJEPG.cmd
DefaultIcon
DefaultIcon
key to a path to the icon you want to use. Example:E:\Tools\Adobe\Adobe Photoshop CC 2015\Photoshop.exe,30
5. Update the file type to open and edit with Photoshop
shell\open\command
key inside your file type key. Example:HKEY_CLASSES_ROOT\Applications\customJEPG.cmd\shell\open\command
"E:\Tools\Adobe\Adobe Photoshop CC 2015\Photoshop.exe" "%1"
edit\command
key inside theshell
key if it does not exist. Example:HKEY_CLASSES_ROOT\Applications\customJEPG.cmd\shell\edit\command
open\command
key. Example:"E:\Tools\Adobe\Adobe Photoshop CC 2015\Photoshop.exe" "%1"
6. Refresh the desktop
You will not see anything change until you refresh the desktop. There are 3 ways to do so:
ie4uinit.exe -show
. In Windows 7 and 8 runie4uinit.exe -ClearIconCache
. (Thanks to @Tony for this tip.)Or, you can restart explorer.exe:
explorer.exe
explorer.exe
->End task and click End Processexplorer.exe
and hit OK7. Test it out
If the "How do you want to open this file?" window pops up again, make sure your dummy .cmd file is still selected under "Keep using this app" at the top, check "Always use this app to open .jpg files", and hit OK.
8. Delete the dummy .cmd
You can delete your dummy .cmd file. This is optional.
A note about finding icons
Often, an app's .exe will contain multiple icons. For example, the Photoshop.exe contains all the icons for all the different file types it supports. Here's how to find and use these icons:
(column - 1) * 4 + row - 1
. For example, if the icon is in column 6, row 3,(6 - 1) * 4 + 3 - 1 = 22
C:\Example\Photoshop.exe,23