如何在Windows 7资源管理器中启用VBA代码等文件的预览功能?
Great question! Adding the PerceivedType registry string is exactly the right move to get these text-based file types showing up in Windows Explorer's preview pane. Here's a safe, step-by-step breakdown tailored to your needs:
First: Backup Your Registry (Critical!)
Before tweaking any registry settings, it’s wise to back up the relevant keys or your entire registry. Here’s how:
- In Registry Editor (
regedit), right-click the key you’re about to modify (e.g.,HKEY_CLASSES_ROOT\.log) and select Export. - Save the .reg file somewhere secure—this lets you revert changes if anything goes wrong.
Option 1: Manual Registry Editing
Repeat these steps for each file type: .log, .list, .bas, .cls, .frm
- Press
Win + R, typeregedit, and hit Enter. Confirm the User Account Control prompt if it appears. - Navigate to the registry key for your target file extension:
- .log:
HKEY_CLASSES_ROOT\.log - .list:
HKEY_CLASSES_ROOT\.list - .bas:
HKEY_CLASSES_ROOT\.bas - .cls:
HKEY_CLASSES_ROOT\.cls - .frm:
HKEY_CLASSES_ROOT\.frm
- .log:
- Right-click the extension key, hover over New, and select String Value.
- Name the new string
PerceivedType. - Double-click
PerceivedType, set its Value data totext, and click OK.
Option 2: One-Click .reg File Import
If you want to set up all these file types at once, create a registry import file:
- Open Notepad and paste this code:
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\.log] "PerceivedType"="text" [HKEY_CLASSES_ROOT\.list] "PerceivedType"="text" [HKEY_CLASSES_ROOT\.bas] "PerceivedType"="text" [HKEY_CLASSES_ROOT\.cls] "PerceivedType"="text" [HKEY_CLASSES_ROOT\.frm] "PerceivedType"="text" - Save the file as
EnableTextPreview.reg(make sure Save as type is set to All Files to avoid adding a .txt extension). - Double-click the saved .reg file, confirm the prompts to import the settings into your registry.
Final Steps to Activate Changes
After editing the registry:
- Restart Windows Explorer: Open Task Manager (
Ctrl + Shift + Esc), find Windows Explorer under the Processes tab, right-click it, and select Restart. - Ensure the preview pane is enabled: In Explorer, go to the View tab and check Preview pane.
Quick Note
If any of these file types already have a PerceivedType entry (uncommon for most of these), just double-click it and change the value to text instead of creating a new entry. This tells Explorer to treat the file as a text document, triggering the same built-in previewer used for .txt files.
内容的提问来源于stack exchange,提问作者Tom the Toolman

