.hta not associated with notepad as the default, how do I change it?

dinh duc duy 0 Reputation points
2025-11-19T05:48:42.15+00:00

User's image

Like this. How to change default app open .hta file from MSHTA to notepad?


Moved from: Windows Insider program | Windows Insider preview | Files, folders, and storage

Windows for home | Windows 11 | Files, folders, and storage
{count} votes

1 answer

Sort by: Most helpful
  1. Lychee-Ng 10,660 Reputation points Microsoft External Staff Moderator
    2025-11-19T11:47:19.73+00:00

    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 .hta file > 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.exe directory

    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 .hta files to use the txtfile association and open in Notepad.

    3 - Set up via Registry Editor:

    • Press Win + R > type regedit > Navigate to HKEY_CLASSES_ROOT.hta
    • Double-click Default and change its value to txtfile
    • Navigate to: HKEY_CLASSES_ROOT\txtfile\shell\open\command
    • Make it points to: "%SystemRoot%\system32\NOTEPAD.EXE" "%1"
    • Restart your PC and test the .hta file

    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.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.