I'm trying to refresh desktop icons from an HTA using the following:

var shell = new ActiveXObject("WScript.Shell");
shell.run("C:\\Windows\\System32\\ie4uinit.exe -show");

I'm running it as administrator and I'm positive C:\Windows\System32\ie4uinit.exe exists.

If I use the exactly same command from a vbscript .vbs it runs the file successfuly.

Is it some kind of restriction? Why HTA can't run C:\Windows\System32\ie4uinit.exe ?

The error message:

enter image description here

How can I make this work?

  • So what is the error message when it doesn't work? – DavidPostill Sep 18 '18 at 21:16
  • I updated the question with the error screen. – Azevedo Sep 18 '18 at 21:32
  • It still seems to me that 32-bit redirection can account for ie4uinit not found. Are you sure you are executing in 64-bit mode at the moment the dialog is displayed? – harrymc Sep 21 '18 at 18:41
  • Positive. 64bit. I checked the proccess image in the task manager. – Azevedo Sep 21 '18 at 20:29
  • What happens when you run as System using psexec -i -s? As another test enable for your account Bypass traverse checking. – harrymc Sep 22 '18 at 7:24

Your registry key of HKEY_LOCAL_MACHINE\SOFTWARE\Classes\htafile\Shell\Open\Command contains the value of :

C:\Windows\SysWOW64\mshta.exe "%1" {1A460BD7-F1C3-4B2E-88BF-4E770A288AF5}%U{1A460BD7-F1C3-4B2E-88BF-4E770A288AF5} %*

The is the 32-bit HTA handler, which means that you are running in 32-bit mode.

This further means that you are using the 32-bit version of VBScript, so that Windows file redirection is actually causing it to look in C:\Windows\SysWOW64, where ie4uinit.exe does not exist.

A solution to avoid maintaining two different versions of your VBScript scripts is to be found in this ServerFault answer.

Alternatively, you might try starting your application using the 64-bit HTA handler, found at C:\Windows\System32\mshta.exe.

You should be aware of the fact that Microsoft is no longer actively supporting HTA applications, preferring instead to concentrate on Windows Forms and similar technologies, so it is quite likely that HTA will become deprecated some time in the future.

  • All 64bit here. Still not that. I've given the full path to ie4uinit.exe – Azevedo Sep 21 '18 at 18:29
  • Task Manager in Windows 10 no longer shows the 32- and 64-bitness of a process. You need Process Explorer for that, showing the Image Type column, or double-click the exe and see it in the Image field. – harrymc Sep 22 '18 at 16:36
  • You may still in theory access the real system32 by using the File System Redirector : C:\Windows\Sysnative\ie4uinit.exe, although I don't know how well this will work in your environment. Note that Sysnative is not a directory, only a traversal tool, and that it doesn't exist for 64-bit apps. – harrymc Sep 23 '18 at 7:07
  • @Azevedo: Any comments? – harrymc Sep 25 '18 at 17:05
  • Still the same. – Azevedo Sep 25 '18 at 18:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.