Hello dinh duc duy,
Welcome to Microsoft Q&A!
The .hta file type is associated with Microsoft (R) HTML Application Host (MSHTA) by default. Windows does not allow changing its association directly because .hta is considered an executable script type and doing so can harm your PC. However, if you still persist:
1 - Try Open With option:
- Right-click any
.htafile > Open with > Choose another app - Pick Notepad and Check Always use this app to open .hta files
- If you can't find the app, directly search for
Notepad.exedirectory
Note: If there's no option at all, Windows is blocking the change for security reasons.
2 - Open Command Prompt as Administrator:
- Enter:
assoc .hta=txtfile - Enter:
ftype txtfile="%SystemRoot%\system32\NOTEPAD.EXE" "%1" - This forces
.htafiles to use thetxtfileassociation and open in Notepad.
3 - Set up via Registry Editor:
- Press Win + R > type
regedit> Navigate toHKEY_CLASSES_ROOT.hta - Double-click
Defaultand change its value totxtfile - Navigate to:
HKEY_CLASSES_ROOT\txtfile\shell\open\command - Make it points to:
"%SystemRoot%\system32\NOTEPAD.EXE" "%1" - Restart your PC and test the
.htafile
Disclaimer: Generally, modifying registry subkeys or work group is intended for advanced users, administrators, and IT Professionals. It can help fix some problems, however, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For further protection, first check out How to back up and restore the registry in Windows - Microsoft Support
Changing .hta files' association prevents them from running, which can harm the system if any application or service is associated with it. If your goal is to edit the file, setting Notepad as the default is fine. If you want to run the program, you should keep the current default.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.