Source Code preview in Windows File Explorer

0
(0)

It can be helpful for developers to look into the source code of files, with the preview of the Windows File Explorer, without need opening all the files.

Source Code Preview with File Explorer

Specifying File Handlers for File Name Extensions with add the registry classes keys to preview files for php, ps1, py, css, vbs, shell scripts and more in File Explorer with just expanding it.

To do this, open a command prompt with elevated rights as an administrator and add the following lines.

REG ADD "HKCR\.sh" /v "PerceivedType" /t REG_SZ /d "text" /f
REG ADD "HKCR\.sh" /ve /t REG_SZ /d "txtfile" /f
REG ADD "HKCR\.sh" /v "Content Type" /t REG_SZ /d "text/plain" /f
REG ADD "HKCR\.sh\PersistentHandler" /ve /t REG_SZ /d "{5e941d80-bf96-11cd-b579-08002b30bfeb}" /f

REG ADD "HKCR\.php" /v "PerceivedType" /t REG_SZ /d "text" /f
REG ADD "HKCR\.php" /ve /t REG_SZ /d "txtfile" /f
REG ADD "HKCR\.php" /v "Content Type" /t REG_SZ /d "text/plain" /f
REG ADD "HKCR\.php\PersistentHandler" /ve /t REG_SZ /d "{5e941d80-bf96-11cd-b579-08002b30bfeb}" /f

REG ADD "HKCR\.py" /v "PerceivedType" /t REG_SZ /d "text" /f
REG ADD "HKCR\.py" /ve /t REG_SZ /d "txtfile" /f
REG ADD "HKCR\.py" /v "Content Type" /t REG_SZ /d "text/plain" /f
REG ADD "HKCR\.py\PersistentHandler" /ve /t REG_SZ /d "{5e941d80-bf96-11cd-b579-08002b30bfeb}" /f

REG ADD "HKCR\.ps1" /v "PerceivedType" /t REG_SZ /d "text" /f
REG ADD "HKCR\.ps1" /ve /t REG_SZ /d "txtfile" /f
REG ADD "HKCR\.ps1" /v "Content Type" /t REG_SZ /d "text/plain" /f
REG ADD "HKCR\.ps1\PersistentHandler" /ve /t REG_SZ /d "{5e941d80-bf96-11cd-b579-08002b30bfeb}" /f

REG ADD "HKCR\.css" /v "PerceivedType" /t REG_SZ /d "text" /f
REG ADD "HKCR\.css" /ve /t REG_SZ /d "txtfile" /f
REG ADD "HKCR\.css" /v "Content Type" /t REG_SZ /d "text/plain" /f
REG ADD "HKCR\.css\PersistentHandler" /ve /t REG_SZ /d "{5e941d80-bf96-11cd-b579-08002b30bfeb}" /f

REG ADD "HKCR\.vbs" /v "PerceivedType" /t REG_SZ /d "text" /f
REG ADD "HKCR\.vbs" /ve /t REG_SZ /d "txtfile" /f
REG ADD "HKCR\.vbs" /v "Content Type" /t REG_SZ /d "text/plain" /f
REG ADD "HKCR\.vbs\PersistentHandler" /ve /t REG_SZ /d "{5e941d80-bf96-11cd-b579-08002b30bfeb}" /f

Now just activate the preview in Windows File Explorer.

Enable PowerToys Thumbnail Previews

Another approachis brings PowerToys. Preview Pane is an existing feature in the Windows File Explorer. Which allows you to see a preview of the file’s contents in the view’s reading pane. PowerToys adds multiple extensions: Markdown, SVG, PDF, and G-code. In addition to those, PowerToys also adds support for source code files (for more than 150 file extensions).

Settings for Source code files previewer

If the preview pane does not appear to work after setting the extension to On. There is an advanced setting in Windows that may be blocking the preview handler. Open the Options menu in Windows File Explorer and select the View tab. Under the View tab, you will see a list of Advanced settings. Ensure that Show preview handlers in preview pane has a check next to it in order for the preview pane to display.

Open Windows File Explorer, select the View menu in the File Explorer ribbon. Hover over Show, and then select Preview pane.

Wie hilfreich war dieser Beitrag?

Klicke auf die Sterne um zu bewerten!

Durchschnittliche Bewertung 0 / 5. Anzahl Bewertungen: 0

Bisher keine Bewertungen! Sei der Erste, der diesen Beitrag bewertet.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert