How can I add default preview for files in Explorer?
Follow these directions to edit the Registry and assign the Windows Text Preview Handler to the .js
file extension. (Based on this How To Geek article.)
- Open Registry Editor
- Navigate to
HKEY_CLASSES_ROOT\.js
and make note of the content of the (Default) value. This is the ProgID to which the.js
extension is registered: - Navigate to the ProgID's key. We'll find our key at
HKEY_CLASSES_ROOT\JSFile
- Expand the key. If necessary, create a subkey named ShellEx
- Under the ShellEx key, create a new key named {8895b1c6-b41f-4c1c-a562-0d564250836f}. Note: According to MSDN the presence of this exact value tells Windows that this is a preview handler.
- Select this newly created key and set its (Default) value to {1531d583-8375-4d3f-b5fb-d23bbd169f22}. This is the ID for Windows' Text Preview Handler.
- The change will take effect immediately.
Since the file contents are just plain text, you can make Explorer treat it as such. You can use Content Type
and PerceivedType
to achieve that. Here is how to do it:
- In the Registry Editor, navigate to the key related to that file type. For the file type asked, the path would be like
HKEY_CLASSES_ROOT\.js
. - In that key, right-click the right panel and choose
New > String Value
. - Name it as
Content Type
. - Double click that value and set it as
text/plain
. - Right-click the right panel and choose
New > String Value
. - Name it as
PerceivedType
. - Double click that value and set it as
text
.
Restart Explorer and voilá! The file will still be associated with any editor you have set but the built-in preview feature will treat it as a text file and then show a preview.
As a side effect, if you sort/group your list in Explorer as Perceived Type it will be classified under Text file.
Note: for instance I did a test by making a .dummy
and associated it with Google Chrome, the file could be previewed in the Preview Pane and double-clicking it still executed Chrome as intended.