[Fix] PDF Preview Shows Directory Index or ERR_FILE_NOT_FOUND

When you preview PDF files in File Explorer or Microsoft Outlook on your Windows 10 or Windows 11 computer, the preview pane may show the directory index of the current folder instead of previewing the PDF file’s contents.

pdf preview shows index of or error file not found

In some cases, it shows the following error:

File not found

It may have been moved, edited, or deleted.
ERR_FILE_NOT_FOUND

pdf preview shows index of or error file not found

Cause

The above symptoms are caused by a bug in the Microsoft Edge PDF Preview handler. The Microsoft Edge’s PDF preview handler fails to generate the preview if the PDF file name or the folder path contains the “#” symbol — e.g., phonebill#2022-04.pdf, #2022-04-phonebill.pdf

If the # symbol is present at the beginning of the file or folder name, the Edge PDF previewer shows the INDEX OF (directory index) in the preview pane. In case the # symbol is present in the middle of the file or folder name, it throws the error “File not found” (ERR_FILE_NOT_FOUND)

This issue is also seen when previewing PDF attachments in Microsoft Outlook.

pdf preview shows index of or error file not found - outlook pdf

If the path to the file or the filename itself contains the pound # symbol, Edge’s PDF previewer might disregard all the path that comes after the pound. Removing the # symbol from the file or folder name resolves this issue.

If you don’t prefer removing the # symbol in the file/folder name, then follow the method discussed below.

[Fix] PDF Preview Shows Directory Index or ERR_FILE_NOT_FOUND

To resolve the PDF preview problem without renaming the PDF files or the folder(s), you may switch to a different previewer module — e.g., Microsoft PowerToys, Adobe Reader, Foxit Reader, or SumatraPDF Reader.

Note that you don’t have to change the PDF file association to resolve the PDF preview problem — you can continue to use your default PDF reader program.

Step 1: Switch to a different previewer module

To switch to a different PDF previewer module quickly using command-line, follow these steps:

First, open an admin Command Prompt window.

Run one of the commands below, depending upon which PDF viewer you’re currently using:

Adobe Reader DC

reg add HKCR\.pdf\ShellEx\{8895b1c6-b41f-4c1c-a562-0d564250836f} /ve /d {DC6EFB56-9CFA-464D-8880-44885D7DC193} /f

Microsoft PowerToys

reg add HKCR\.pdf\ShellEx\{8895b1c6-b41f-4c1c-a562-0d564250836f} /ve /d {A5A41CC7-02CB-41D4-8C9B-9087040D6098} /f

Note: If you prefer using the Microsoft PowerToys preview handler, make sure you have the turn on the “Enable PDF (.pdf) preview” setting on the PowerToys settings page.

Foxit Reader

reg add HKCR\.pdf\ShellEx\{8895b1c6-b41f-4c1c-a562-0d564250836f} /ve /d {1B96FAD8-1C10-416E-8027-6EFF94045F6F} /f

SumatraPDF Reader

reg add HKCR\.pdf\ShellEx\{8895b1c6-b41f-4c1c-a562-0d564250836f} /ve /d {3D3B1846-CC43-42AE-BFF9-D914083C2BA3} /f

The above command(s) changes the default PDF preview handler module in the following registry location automatically:



HKEY_CLASSES_ROOT\.pdf\shellex\{8895b1c6-b41f-4c1c-a562-0d564250836f}

The changes are usually instant; no need to restart Windows.


Step 2: Prevent Edge Updater (Setup.exe) from Modifying the Setting

With “Step 1″ done, there is an additional procedure you may wish to perform.

The Microsoft Edge software update (setup.exe) process overwrites your default PDF preview handler setting (i.e., making the Edge PDF previewer the default) every now and then. Re-running the above commands (every time Microsoft Edge updates itself) may be inconvenient to the user.

To work around that, you have two options:

  1. Stop Edge setup from changing the default Preview Handler via an undocumented registry value.
    (or)
  2. Set the registry key permissions so that the Microsoft edge’s setup.exe process (that runs as NT AUTHORITY\SYSTEM) can’t write to the .pdf registry key.

Method 1: Stop Edge Setup from changing the default Preview Handler

  1. Open an admin Command Prompt window.
  2. Run the following commands:
    reg add HKCR\CLSID\{3A84F9C2-6164-485C-A7D9-4B27F8AC009E} /v EnablePreviewHandler /t REG_DWORD /d 0 /f
    
    reg add HKCR\WOW6432Node\CLSID\{3A84F9C2-6164-485C-A7D9-4B27F8AC009E} /v EnablePreviewHandler /t REG_DWORD /d 0 /f
  3. Exit the Command Prompt window

Editing the registry manually

If you wish to edit the registry manually rather than running the using command-line, then follow these steps instead:

  1. Start the Registry Editor (regedit.exe)
  2. Go to the following branches one by one:
    HKEY_CLASSES_ROOT\CLSID\{3A84F9C2-6164-485C-A7D9-4B27F8AC009E}
    
    HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{3A84F9C2-6164-485C-A7D9-4B27F8AC009E}
  3. Double-click the value named EnablePreviewHandler and set its data to 0.
    enablepreviewhandler - edge pdf preview registry value
  4. Exit the Registry Editor.

The above command-line/registry setting prevents the Edge setup process from changing the default PDF preview handler module in the registry.

(Despite the above registry modification, you can still use Edge’s Preview handler if you want; it’s just that the setup process won’t set it as the default every time. In other words, it does NOT disable Edge’s PDF preview handler capability.)

Method 2: Prevent Write access to PDF Preview Handler Registry key

(If the above procedure has resolved the issue for you, then please skip the following routine.)

  1. Start the Registry Editor (regedit.exe)
  2. Go to the following branch:
    HKEY_CLASSES_ROOT\.pdf\shellex\{8895b1c6-b41f-4c1c-a562-0d564250836f}
  3. Right-click {8895b1c6-b41f-4c1c-a562-0d564250836f} and choose Permissions…
  4. Click Advanced.
  5. Click Add.
  6. Click “Select a principal”
  7. Type SYSTEM and click OK. Microsoft Edge setup.exe runs under the SYSTEM account. On the other hand, if you wish to deny write access to the registry value for ALL user accounts, type EVERYONE and click OK.
  8. In the Type: dropdown, select Deny
  9. In the Applies to: dropdown, select “This key only
  10. Click “Show advanced permissions”
  11. Select the “Set Value” checkbox.
    pdf preview shows index of or error file not found - outlook pdf
  12. Click OK.
  13. Click OK.
  14. Click Yes when you see the following prompt:
    You are setting a deny permissions entry. Deny entries take precedence over allow entries. This means that if a user is a member of two groups, one that is allowed a permission and another that is denied the same permission, the user is denied that permission. Do you want to continue?
  15. Exit the Registry Editor.

That’s it. You’ve revoked the “Set value” permissions for this key (for every user on the computer). Microsoft Edge setup/update processes (Setup.exe or MicrosoftEdgeSetup.exe) can’t modify the registry value during software updates; they silently encounter the ACCESS DENIED error when attempting to update the PDF preview handler registry value. Regardless, the updater should be able to install/update Edge Chromium successfully.

Other workarounds: If you don’t want to modify registry permissions, then you may choose to run the reg.exe command-line every time Microsoft Edge updates itself. Or, you may create a desktop shortcut/Batch file/Task Scheduler Startup or Logon job to execute the above command automatically.

(Microsoft Edge version is 101.0.1210.32 Official build as of this blog post and everything written on this page is based on Edge 101.0.1210.32.)


One small request: If you liked this post, please share this?

One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
  • Pin it!
  • Share it to your favorite blog + Facebook, Reddit
  • Tweet it!
So thank you so much for your support. It won't take more than 10 seconds of your time. The share buttons are right below. :)

Ramesh Srinivasan is passionate about Microsoft technologies and he has been a consecutive ten-time recipient of the Microsoft Most Valuable Professional award in the Windows Shell/Desktop Experience category, from 2003 to 2012. He loves to troubleshoot and write about Windows. Ramesh founded Winhelponline.com in 2005.

5 thoughts on “[Fix] PDF Preview Shows Directory Index or ERR_FILE_NOT_FOUND”

  1. Thank you,
    I have now tried 2 months in vain to solve the Proplem!
    That was the first successful solution proposal.
    Good job!!!

    Reply
  2. This solved a major customer complaint that we have had for a few months and have been unable to solve. Thanks for the post that our tech found and resolved the issue for that customer.

    Reply

Leave a Reply to Gno Gname Cancel reply