In this article, I will show you how to associate files with Notepad in Windows 11.
Introduced before How to revert Notepad to an older version in Windows 11 After restoring Notepad to the previous version, for exampleextensionHowever, we have received inquiries from users asking if it is possible to associate files such as ".js", ".html", and ".py" with Notepad.
If you revert to an older version of Notepad, you may not be able to associate it with Notepad using the usual methods.
Also, some apps cannot be modified in the normal way.
Even if you specify "C:\Windows\System32\notepad.exe" from "Open with", it will not be associated.
Please refer to this if you are unable to change the association using the normal method.
How to set file associations to Notepad
To associate files with the old Notepad, you will need to edit the registry.
If you operate the registry incorrectly, it may cause problems such as the system being unable to start. Please make a backup in advance using system restore or similar, and proceed at your own risk.
- How to create and restore a system restore point
- How to open and back up the Registry Editor
- Windows 11/10 Registry Basics: Concept, How to Open, and Internal Structure
- How to Take Ownership and Change Permissions in Windows 11 Registry
1. Press Windows key + R to open Run, type "regedit" and press Enter.
2. The Registry Editor will open. For example, if you want to change the file association for ".js", open the following key:
HKEY_CLASSES_ROOT\.js
The HKEY_CLASSES_ROOT\ key contains information about many file extensions.
".js", ".html", etc. after HKEY_CLASSES_ROOT\extension.
3. With the ".js" key selected, double-click the "(Default)" value data in the right column to open it.
4. Copy this value data and close "Edit String".
5. Press the "Ctrl + F" keys on your keyboard.
6. "Search" will open, so paste the value you copied into "Search value".
7.Uncheck "Value" and "Data" under "Search for".
8. Click Find Next.
This will search for the following key:
HKEY_CLASSES_ROOT\JSFile
FirstBack up your keysThen proceed to the next step.
9. Double-click each key: JSFile > Shell > Open > Command, and look at the value data for "(Default)" in the right column.
C:\Windows\System32\WScript.exe "%1" %*
The application registered here is the program that will run when you double-click a ".js" file.
10. Double-click "(Default)" to open it and change the value data as follows: (All half-width characters)
C:\Windows\System32\notepad.exe "%1" %*
11. Click OK to exit Edit String.
At this point, double-clicking a ".js" file will open Notepad.
Try changing ".html" and ".py" in the same way.
If the extension key does not exist
If the extension key does not exist, try adding it.
For example, suppose there is no ".py".
1. Right-click on "HKEY_CLASSES_ROOT" > New > "Key".
2. Rename "New Key #1" to ".py".
3. With the ".py" key selected, double-click "(Default)" in the right column to open it.
4. Enter "pyfile" in the Value data and click OK.
Now that you have added the ".py" key, return to the "HKEY_CLASSES_ROOT" key.
5. Right-click on the "HKEY_CLASSES_ROOT" key > New > "Key".
6. Change the name of "New Key #1" to "pyfile" as mentioned earlier.
7. Right-click on the "pyfile" key > New > "Key".
8. Rename "New Key #1" to "Shell".
9. Right-click on the "Shell" key > New > "Key".
10. Rename "New Key #1" to "Open".
11. Right-click on the "Open" key > New > "Key".
12. Rename "New Key #1" to "Command".
13. With the "Command" key selected, double-click "(Default)" in the right column to open it, and enter the following command in the value data:
C:\Windows\System32\notepad.exe "%1" %*
14. Click OK.
At this point, you can double-click the ".py" file to open it in Notepad.
Change a file's icon
Files with unregistered extensions have a white icon by default.

Let's change this icon to a text file icon.
1. Right-click on the "pyfile" key you just added and click New > Key.
2. Rename "New Key #1" to "DefaultIcon".
3. With the "DefaultIcon" key selected, double-click "(Default)" in the right column to open it, and enter the following command in the value data:
C:\Windows\System32\shell32.dll,70
4. Once you're done editing, close Registry Editor and sign out of your PC.
Once you sign in, the icon will change to a text file icon.

If the icon is not updated when you change it again, try deleting the icon cache.

If you cannot change it, such as ".html"
If you are unable to change the association using the above method, or if specifying "C:\Windows\System32\notepad.exe" from "Open with" does not result in an association, try the following method.
1. For example, if your file is ".html", first open the following key:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.html\OpenWithProgids
*If the file has a different extension, the ".html" in this key will be the extension, so open the desired key.
2. With the "OpenWithProgids" key selected, you can see the value "htmlfile" (REG_NONE) in the column on the right.
3. Right-click on the value "htmlfile" and click "Rename".
4. Rename the value to "txtfilelegacy".
5. Now that the registry editing is complete, try right-clicking on a ".html" file.
If you move the mouse cursor over "Open with," you'll see that "Notepad" has been added.
6. Just click "Select another program".
7. "Notepad" is displayed under "Recommended apps" under "Choose an app to open .html files." Click "Notepad" and then click "Always use."
8. The ".html" file will then open in Notepad.
At this point, ".html" files will be associated with Notepad.
The icon has also changed from a browser icon to a text file icon.
If you want to revert, select your browser from "Choose another program" and click "Always use."
Added the ability to open selected links or open them in a browser to Win11 Notepad.























Comment: