Jump to content

Silently associate .hta files with mshta.exe?


Recommended Posts

I have n-Lited a Windows XP CD. As I hate Interent Explorer, I always remove that from the install. I do leave the IE Core files, though, so mshta.exe is still in the new install.

I have WPI set up to begin loading my programs after windows boots up. However, because I have removed IE, wpi.hta is not auto-associated with .hta files and I manually have to locate the mshta.exe file in order to load wpi.hta.

Is there a registry tweak or something I can add into NLite that will auto-associate and auto-play an .hta file with mshta.exe?

Thanks for your help!

Edited by radigast
Link to comment
Share on other sites


Thanks for the quick responses.

Another question for you:

This code

start /wait %windir%\system32\mshta.exe "%CD%\wpi.hta"

should be put into a *.bat or *.cmd file in the $OEM$ directory, and then a line should be added to cmdlines.txt that says *.bat or *.cmd in order to properly call the script right?

Link to comment
Share on other sites

for /f "delims=: tokens=1" %%i in ("%~dp0") do set drive=%%i:
set wpipath=%drive%\wpi

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Runonceex

REG ADD %KEY% /V WPI /D "%windir%\system32\mshta.exe "%wpipath%\WPI.hta"" /f

Try this for the best bet... and yes add *.cmd or *.bat to cmdlines.txt

Link to comment
Share on other sites

I am using the RunWPI.exe tool in the $OEM$ folder, and the cmdlines.txt entry for that is "RunWPI.exe". Should I remove the "RunWPI.exe" from the cmdlines.txt, and remove RunWPI.exe from the $OEM$ folder since I am calling WPI.hta with this new .bat file? Or does RunWPI.exe do more things than just initially script WPI to be called?

Edited by radigast
Link to comment
Share on other sites

RunWPI.exe not only adds the runonceex entry to the reg it add the "Official" MCE (Royale) Theme to your PC and the entries for that to skin your runonce windows thus making the installation window much more apealling...

SO either I make a special one for you after you test out the cmd file. or you just use the cmd file.

Do take out the RunWPI.exe line though don't use both...

Link to comment
Share on other sites

I am in the process of re-NLiteing and testing the .cmd now. I'll repost the results. Thanks again Kels! WPI is a work of art!

In regards to a "special" RUNWPI.exe, if you want to make it, that would be sweet. If you don't want to make, that's fine with me too. :)

Link to comment
Share on other sites

for /f "delims=: tokens=1" %%i in ("%~dp0") do set drive=%%i:
set wpipath=%drive%\wpi

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Runonceex

REG ADD %KEY% /V WPI /D "%windir%\system32\mshta.exe "%wpipath%\WPI.hta"" /f

Try this for the best bet... and yes add *.cmd or *.bat to cmdlines.txt

In that case you can do it without the for loop and get rid of the first two lines.

Place the following code as your runoceex key data instead:

"%systemroot%\system32\mshta.exe \"%~d0\wpi\wpi.hta\""

Link to comment
Share on other sites

I repackaged the iso file with the .cmd file and the updated cmdlines.txt. In my virtual machine, the RunOnceEx entry was correctly added, but WPI.hta failed to launch. Windows installed, and the wpi screen never came up.

Here is the line as it appears in the registry of VMWare:

C:\WINDOWS\system32\mshta.exe D:\wpi\WPI.hta

This means the cmdlines.txt and .bat file are correct. Why didn't wpi.hta launch??

Edited by radigast
Link to comment
Share on other sites

Aside from the problem you're having with the execution of those commands, did you try registering the HTML Application Host application.

%systemroot%\system32\mshta.exe /register

I'm only guessing here obviously since I've never removed IE.

Link to comment
Share on other sites

I'm not sure what to do with

%systemroot%\system32\mshta.exe /register

When I put it as a .cmd file and double-click the newly made .cmd file, the text

E:\Temp\Windows XP\$OEM$ >;D:\WINDOWS\system32\mshta.exe /register
just pops up on the screen and stays there. How do I implement your code to register mshta.exe?

On another note, I figured out how to register the .hta extension with mshta.exe using a .reg file (hta.reg).

hta.reg

Windows Registry Editor Version 5.00

;Open HTA files (used for WPI) with MSHTA.EXE

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.hta]
"Application"="mshta.exe"

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

Just for testing purposes, I scrapped the command to call wpi.hta with mshta.exe, and reverted back to using RunWPI.exe in the hopes that my newly made regtweak would auto-associate an .hta extension with mshta.exe and thus auto-open wpi.hta. It does register the .hta file, but only after Windows has been restarted. This is too late, since RunWPI.exe is the entry after my regtweak in cmdlines.txt. In other words, RunWPI.exe is called before the computer is restarted, so the .hta file extension has not been registered with mshta.exe yet (I think). Is there anyway to restart the computer between these cmdlines.txt entries so that the computer has had time to associate .hta files with mshta.exe? I am pretty sure that wpi.hta would then be properly called and associated with mshta.exe.

For completion, here is a copy of my cmdlines.txt so you can see what I mean.

cmdlines.txt

[COMMANDS]
"rundll32 advpack.dll,LaunchINFSection nLite.inf,U"
"REGEDIT /S hta.reg"
"RunWPI.exe"

Edited by radigast
Link to comment
Share on other sites

Well, I have tried:

1. the RunOnceEx batch file command.

WPI.hta is never called during Windows installation. I used the above pieces of code, made the batch file to open WPI.hta with mshta.exe, and added the proper line to call the batch file in cmdlines.txt, BUT WPI.hta never loaded.

2. adding the above registry entries to associate .hta filetypes with mshta.exe.

.hta files were properly associated with mshta.exe, BUT not during installation of Windows. Hence, I still had to manually navigate to and select mshta.exe from the system32 directory in order to begin WPI.hta.

Someone out there must have gone through the same situation as I am, as I am sure many people use WPI and choose to uninstall Internet Explorer. How did you get WPI.hta to properly and silently load with Internet Explorer removed?

Edited by radigast
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...