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.
In some cases, it shows the following error:
File not found It may have been moved, edited, or deleted. ERR_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.
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:
- Stop Edge setup from changing the default Preview Handler via an undocumented registry value.
(or) - 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
- Open an admin Command Prompt window.
- 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
- 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:
- Start the Registry Editor (
regedit.exe
) - 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}
- Double-click the value named
EnablePreviewHandler
and set its data to0
.
- 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.)
- Start the Registry Editor (
regedit.exe
) - Go to the following branch:
HKEY_CLASSES_ROOT\.pdf\shellex\{8895b1c6-b41f-4c1c-a562-0d564250836f}
- Right-click
{8895b1c6-b41f-4c1c-a562-0d564250836f}
and choose Permissions… - Click Advanced.
- Click Add.
- Click “Select a principal”
- 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, typeEVERYONE
and click OK. - In the Type: dropdown, select Deny
- In the Applies to: dropdown, select “This key only“
- Click “Show advanced permissions”
- Select the “Set Value” checkbox.
- Click OK.
- Click OK.
- 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?
- 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!
Thank you,
I have now tried 2 months in vain to solve the Proplem!
That was the first successful solution proposal.
Good job!!!
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.
Good work champ. Hope you keep it up.
Good job. It works to me, many thanks!
Nice solution. really helpful!~ thank you!