How to make windows explorer preview scripts and other text files

Solution 1:

The answer came from this link this link as music2myear mentioned but the accepted answer in that link did not work for me.

What worked for me was 2nd answer in the thread. Member user255627 points out the correct key is HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.py which requires attribute PerceivedType REG_SZ text.

I created an attribute in this key with reg command. You can substitute .py with any extension type and enable a bunch of extensions this way. No need for a external program as mentioned in other thread.

from windows command prompt cmd.exe

reg add HKLM\SOFTWARE\Classes\.py /v PerceivedType /t REG_SZ /d text

If you don't have reg permissions to HKLM (local machine) you can use HKCU (current user)

reg add HKCU\SOFTWARE\Classes\.py /v PerceivedType /t REG_SZ /d text

You can query like this.

reg query HKLM\SOFTWARE\Classes\.py /s

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.py
(Default)    REG_SZ    Python.File
PerceivedType    REG_SZ    text

Thanks for the help guys. very useful.

Solution 2:

Several years back I hunted for additional preview handlers and found some:

  • from MSDN Magazine (see list below)
  • some build with/for Delphi

I'm still searching for online references, they might be no longer available.

Aside from this there is a preview-handler-association-editor you can download and use to add extension to a present handler (i.e. add .ini, .inf extension to a text handler.)


I wrote a batch file to enumerate currently present handlers in the registry. It appends found handlers to the batch file itself and displays them afterwards.

 @Echo off
Echo/>>%0
Echo ============================================ >>%0
Echo Computername: %ComputerName% Date: %Date% %Time:~0,6% >>%0
reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\PreviewHandlers" >>%0
More +9 <%0
Pause
goto :EOF

Sample output:

============================================ 
Computername: xxxxx Date: 2018-05-08 20:47: 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\PreviewHandlers
    {13D3C4B8-B179-4ebb-BF62-F704173E7448}    REG_SZ    Windows Contact Preview Handler
    {1531d583-8375-4d3f-b5fb-d23bbd169f22}    REG_SZ    Windows TXT Previewer
    {53BEDF0B-4E5B-4183-8DC9-B844344FA104}    REG_SZ    Microsoft Windows MAPI Preview Handler
    {85862EDA-F507-4d5b-ACA9-BB2C34A85682}    REG_SZ    Microsoft XPS Rich Preview Handler
    {8a7cae0e-5951-49cb-bf20-ab3fa1e44b01}    REG_SZ    Windows Font previewer
    {92dbad9f-5025-49b0-9078-2d78f935e341}    REG_SZ    Microsoft Windows Mail Mime Preview Handler
    {a42c2ccb-67d3-46fa-abe6-7d2f3488c7a3}    REG_SZ    Windows RTF Previewer
    {b9815375-5d7f-4ce2-9245-c9d4da436930}    REG_SZ    Microsoft Windows Mail Mime Preview Handler
    {BFD468D2-D0A0-4bdc-878C-E69C2F5B435D}    REG_SZ    Microsoft Windows Mail Html Preview Handler
    {E64164EB-1AE0-4C50-BAEF-A413C2B3A4BC}    REG_SZ    Microsoft 3MF Shell Thumbnail and Preview Handler
    {f8b8412b-dea3-4130-b36c-5e8be73106ac}    REG_SZ    Microsoft Windows Mail Html Preview Handler
    {031EE060-67BC-460d-8847-E4A7C5E45A27}    REG_SZ    Windows Media Player Rich Preview Handler
    {691100A7-2A53-456B-BFE5-6BA17A0AB768}    REG_SZ    Delphi Asm Preview Handler
    {B8961094-8033-4D5B-AAB3-A6BCC76EB7A5}    REG_SZ    Delphi Cpp Preview Handler
    {5B96A782-E9C7-4620-B9DA-4B219BF97AB3}    REG_SZ    Delphi Xml Preview Handler
    {AD8855FB-F908-4DDF-982C-ADB9DE5FF000}    REG_SZ    Delphi Preview Handler
    {f2d43dd7-1233-4d5f-9032-b82a570aee81}    REG_SZ    MSDN Magazine RESX Preview Handler
    {21c532d1-6f1a-4f53-a000-0468a4337ab5}    REG_SZ    MSDN Magazine MSI Preview Handler
    {574fffaa-17f6-44b1-a1b4-177ab5900a51}    REG_SZ    MSDN Magazine PDF Preview Handler
    {df9e65b0-7980-4053-9fcf-6e9af953a9f4}    REG_SZ    MSDN Magazine Binary Preview Handler
    {853f35e3-bd13-417b-b859-1df25be6c834}    REG_SZ    MSDN Magazine ZIP Preview Handler
    {739972dc-dad1-4e8c-bb82-113de4b16b13}    REG_SZ    MSDN Magazine Resources Preview Handler
    {2d6dad69-f296-4be0-ab9e-6ed642aef76b}    REG_SZ    MSDN Magazine Strong Name Key Preview Handler
    {8fd75842-96ae-4ac9-a029-b57f7ef961a8}    REG_SZ    MSDN Magazine Internet Explorer Preview Handler
    {47f228f7-5338-4bb4-af7b-7b52278e1095}    REG_SZ    MSDN Magazine CSV Preview Handler
    {e90a8adf-a1a7-42e8-87b9-02b3bfee31f7}    REG_SZ    MSDN Magazine Serialized Ink Preview Handler
    {dec9ca47-e4cd-4eed-8f1b-b0567a489f0a}    REG_SZ    MSDN Magazine XAML Preview Handler
    {DC6EFB56-9CFA-464D-8880-44885D7DC193}    REG_SZ    Adobe PDF Preview Handler for Vista
    {84F66100-FF7C-4fb4-B0C0-02CD7FB668FE}    REG_SZ    Microsoft Word previewer
    {21E17C2F-AD3A-4b89-841F-09CFE02D16B7}    REG_SZ    Microsoft Visio previewer
    {65235197-874B-4A07-BDC5-E65EA825B718}    REG_SZ    Microsoft PowerPoint previewer
    {00020827-0000-0000-C000-000000000046}    REG_SZ    Microsoft Excel previewer