79

I want to preview .js, .php, and other file extensions as text in explorer on Windows 7.

Any ideas on how I can accomplish this?

2
  • 2
    In the meantime, check out: howtogeek.com/forum/topic/…
    – ZoogieZork
    Commented Jan 5, 2010 at 20:02
  • 2
    1. Press "Win" key 2. Type cmd 3. Press "Ctrl+Shift+Enter" 4. Copy reg add HKLM\SOFTWARE\Classes\.php /v PerceivedType /t REG_SZ /d text 5. Paste in CMD with right click 6. Press "Enter" 7. Repeat from step 4, replacing php with js. Note: If insufficient privileges, replace HKLM with HKCU
    – s3c
    Commented Nov 18, 2021 at 9:03

10 Answers 10

70

On top of using PreviewConfig, you will also have to add entries into the registry to get it working on Windows 7.

  • Open the registry editor (regedit in the start menu search) and navigate to computer\HKEY_CLASSES_ROOT\.FILE_EXT, where FILE_EXT is the extension you want to add, such as .nfo

    enter image description here

  • Make 2 new string values (REG_SZ) under the file extension's key, Content Type and PerceivedType

    enter image description here

  • Set the value of Content Type to text/plain and PerceivedType to text.


7
  • On Win 7, I got not success on .m3u using PreviewConfig img818.imageshack.us/img818/9910/regionuj.png or the manual method too img17.imageshack.us/img17/3674/registryeditor.png . Any ideas?
    – ChrisJJ
    Commented Mar 12, 2013 at 22:55
  • 5
    I am not totally sure but it is not Perceived Type, it is PerceivedType
    – Devid
    Commented Oct 25, 2013 at 22:15
  • Success!! Per the answer below for most file types I did not need to manually edit the registry but for .config files I did because it had already been registered as ContentType application/xml and did not want to update. Thanks!
    – groksrc
    Commented Mar 20, 2014 at 19:19
  • Note well (I should have): en.wikipedia.org/wiki/I_before_E_except_after_C
    – dcromley
    Commented Mar 7, 2015 at 2:28
  • 1
    I have found this method (registry fix) works for .eml files without bothering with PreviewConfig at all - Windows 8.1.
    – gogoud
    Commented Jul 2, 2015 at 12:07
32

I just went to RegEdit> HKEY_LOCAL_MACHINE > SOFTWARE > Classes

Found .log

Added a new String Value with Value Name PerceivedType and Value Data text.

Started working straight away.

10
  • where did you get this tutorial from? please consider adding your source. Commented Sep 19, 2013 at 10:25
  • The benefit of this method is that if you change the viewer for the underlying type all types that are perceived as it will change too.
    – Sam Hasler
    Commented Jun 30, 2014 at 11:56
  • 1
    This worked for Windows 10 also and was very easy to do.
    – smcintosh
    Commented Mar 13, 2016 at 20:06
  • 1
    Perfect! I wanted to do this for markdown files on Windows 10. Went to the same location and looked for .md and added the same thing (PerceivedType: text). Voila, it worked right away.
    – ba_ul
    Commented Aug 6, 2017 at 13:11
  • 2
    If anyone wants a powershell 1-liner: [microsoft.win32.registry]::SetValue("HKEY_CURRENT_USER\Software\Classes\.js", "PerceivedType", "text") credit: @Dubas on a different question
    – Daryn
    Commented Mar 5, 2020 at 9:52
19

As of June 2010, PreviewConfig will handle Windows 7 file preview duties without the need for any manual registry editing.

12

You can solve this by using a little tool created by a Microsoft guy (Stephen Toub) called "PreviewHandlerEditor.exe", which is available here:

http://blogs.msdn.com/b/toub/archive/2006/12/14/preview-handler-association-editor.aspx

Download and open the tool, uncheck "Only show classes associated with this handler", select a registered preview handler from the dropdown menu (e.g. "Windows TXT Previewer"), scroll through the list of classses/extensions, and select the file type you are having trouble previewing in Windows search.

I found this answer via: http://answers.microsoft.com/en-us/windows/forum/windows_7-files/no-preview-available-there-are-several-files-that/9a93872f-db8e-450a-96b1-951a3d687fd9?page=2&tm=1423925169058#LastReply

Direct download link to app: https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/01/28/65/88/PreviewHandlerEditor.zip

4
  • I find this tool to be more capable than the one in the accepted answer. It allows me to add and remove handlers from filetypes without limitation. Thanks, @Michael for the link to the download - the links in Toub's original blog posting no longer work.
    – yosh m
    Commented Apr 19, 2015 at 11:42
  • 1
    no need for tools. windows provides it check out the solution here link Commented Nov 20, 2019 at 1:16
  • The blog post appears to be gone, but the direct download link still works. Thanks
    – Sam Hasler
    Commented Sep 7, 2020 at 9:39
  • blog post is gone, and direct link does not work anymore, all links are dead.
    – Rainb
    Commented Feb 9, 2022 at 13:25
5

To view .ai in windows 7 preview handler

  1. Navigate to .ai folder in the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Classes.ai
  2. Under that make a key named ShellEx if not already there
  3. Under ShellEx create a key name {8895b1c6-b41f-4c1c-a562-0d564250836f}
  4. Under this new key change the data value to {DC6EFB56-9CFA-464D-8880-44885D7DC193} (I would have posted an image but Im not allowed to by the system but I'm sure you got it!)

Now even Adobe Illustrator files show up in the preview handler and you look like a Pro! This is possible as the preview handler for PDF files and AI files are the same so all that is being done is copy/paste the PDF one to the AI one!

2

Try please:

PreviewConfig Tool Registers File Types for the Preview Pane in Windows 7/Vista

2
  • 2
    Could you summarize your article here? We prefer you don't just link your own site as an answer Commented Feb 15, 2012 at 22:39
  • 1
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes.
    – Ramhound
    Commented Jul 16, 2015 at 12:59
2

In addition to the accepted answer: If you don’t have the privilege to add a key under HKEY_CLASSES_ROOT\.log (e.g. on a computer in an office environment):

You can create the same keys under HKEY_CURRENT_USER\Software\Classes\.log

Worked for me with Windows 10.

1

Using powershell

[microsoft.win32.registry]::SetValue("HKEY_CURRENT_USER\Software\Classes\.js", "PerceivedType", "text")

Thanks to Daryn's comment

1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Feb 12, 2023 at 17:13
0

I'm too lazy to looking for the .ext(the extension file i want). So, i do:

Go to Regedit(i do with Windows+R hotkey and 'regedit' input) and set the quick view as text like above answer

Go... RegEdit> HKEY_LOCAL_MACHINE > SOFTWARE > Classes and ...

After that, export and save(ex: log.reg) this config with right-click menu enter image description here

So, with another file extention you can edit(and save) above log.reg with your wanna .ext Examle for .less file

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes.less] @="txtfile" "PerceivedType"="text"

Double click this file to apply effect.

Note: I think yo should do it your self because some(strange) .reg can be harm for your system

0

Easy to do with PowerShell.

An example that sets text preview for .js extension:

Set-ItemProperty Registry::HKEY_CLASSES_ROOT\.js -Name PerceivedType -Value text
Set-ItemProperty Registry::HKEY_CLASSES_ROOT\.js -Name 'Content Type' -Value 'text/plain'

or if you want to set it for multiple extensions (.js and .php for example):

'.js', '.php' | % { 
    Set-ItemProperty Registry::HKEY_CLASSES_ROOT\$_ -Name PerceivedType -Value text
    Set-ItemProperty Registry::HKEY_CLASSES_ROOT\$_ -Name 'Content Type' -Value 'text/plain'
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .