1

I have a number of HTAs on my computer.

Now when I try to run them, I get the message:

This app can't run on your PC.

To find a version for your PC, check with the software publisher.

Even a simple HTML file, renamed to the .hta extension, has the same problem.

When I try Open With in the context menu, the mshta.exe executable no longer appears in the context menu (like it used to). When I browse to it (either the 32-bit or 64-bit version) I get the following:

The program you have selected cannot be associated with this file type. Please choose another program.

I get the same message whether or not I've checked the Always use this app to open '.hta' files checkbox.

When I try calling mhsta.exe from the command line and passing in the name of the HTA as an argument, the HTA doesn't open, but there are no additional errors.

Are HTAs now deprecated / disabled? How can I resolve this?

I am running:

Windows 10 Pro
Version 1709
OS Build 16299.431
64-bit architecture and OS

2
  • 1
    Same Version but Build 16299.371 and no Problem with .hta files
    – LotPings
    May 13, 2018 at 0:43
  • works on my win10 , and im on latest april spring update May 15, 2018 at 14:34

2 Answers 2

6
+50

Run the following two commands as administrator:

  • Add file type with ftype command:
ftype htafile=C:\Windows\SysWOW64\mshta.exe "%1" {1E460BD7-F1C3-4B2E-88BF-4E770A288AF5}%U{1E460BD7-F1C3-4B2E-88BF-4E770A288AF5} %* 
  • Associate .hta extension with assoc command:
assoc .hta=htafile 

Then sign out and re-sign in to your account.

3
  • Is there any benefit to doing this over direct registry manipulation?
    – Zev Spitz
    May 15, 2018 at 15:32
  • This command is copied from latest Windows. And you've to run just two commands.
    – Biswapriyo
    May 15, 2018 at 15:34
  • Yes. If there are no better answers I will award the bounty here.
    – Zev Spitz
    May 15, 2018 at 15:36
2

Try to see if your antivirus product has decided that .hta applications are a security threat (which they are, allowing an html file to modify the system).

If you need to reestablish the registry settings for .hta applications, you may create and execute a .reg file containing the following text. The contents are a modification of the github file Default_HTA.reg with data from my computer :

Windows Registry Editor Version 5.00

[-HKEY_CLASSES_ROOT\.hta]

[HKEY_CLASSES_ROOT\.hta]
"PerceivedType"="text"
@="htafile"
"Content Type"="application/hta"

[HKEY_CLASSES_ROOT\.hta\PersistentHandler]
@="{eec97550-47a9-11cf-b952-00aa0051fe20}"

[-HKEY_CLASSES_ROOT\htafile]

[HKEY_CLASSES_ROOT\htafile]
"EditFlags"=dword:00100000
@="HTML Application"
"FriendlyTypeName"="@C:\\Windows\\System32\\mshta.exe,-6412"

[HKEY_CLASSES_ROOT\htafile\CLSID]
@="{3050f4d8-98B5-11CF-BB82-00AA00BDCE0B}"

[HKEY_CLASSES_ROOT\htafile\DefaultIcon]
@="C:\\Windows\\System32\\mshta.exe,1"

[HKEY_CLASSES_ROOT\htafile\Shell]

[HKEY_CLASSES_ROOT\htafile\Shell\Open]

[HKEY_CLASSES_ROOT\htafile\Shell\Open\Command]
@="C:\\Windows\\SysWOW64\\mshta.exe \"%1\" %*"

[-HKEY_CLASSES_ROOT\SystemFileAssociations\.hta]

[-HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.hta]

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.hta]

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.hta\OpenWithList]
"a"="IEXPLORE.EXE"
"MRUList"="a"

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.hta\OpenWithProgids]
"htafile"=hex(0):

Please note that the above text of C:\\Windows\\SysWOW64\\mshta.exe relates to 32-bit execution. For 64-bit execution use instead C:\\Windows\\System32\\mshta.exe.

As further note, please create a system restore point before doing any registry changes, just in case.

2
  • I am using Avira Free antivirus. There doesn't seem to be any explicit option to disable HTAs, nor did I find any settings that seem to be related.
    – Zev Spitz
    May 15, 2018 at 15:36
  • that was a really PERFECT answer, how did you know those changes on the registry? May 26, 2019 at 17:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .