Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

so that when I view source it is notepad2 that opens the doc up. I already have notepad2 downloaded.

share|improve this question

You can do this by directly adding / editing the Registry Keys.

Type regedit.exe on Run.

On other way, below is NON - TESTED vbscript code:-

NOTE: Please be careful, while playing with registry keys.


Set WshShell = CreateObject("WScript.Shell")
Set fs = CreateObject("Scripting.FileSystemObject")
Dim MyKey, EditorName, KeyToAdd, rtn, MyKeySelf
MyKey = Inputbox("Type the application name with full path", "Add a HTML Editor", "C:\Windows\Notepad.exe")

if trim(MyKey) = "" then WScript.Quit

MyKeySelf = """" + MyKey + """" & " " & """" + "%1" + """"

if not fs.fileexists(MyKey) then
    rtn = msgbox("Specified file is missing, do you want to continue anyway?", 36, "Add a HTML Editor")
        if rtn = 6 then
            Call AddEditor
        end if
    Call AddEditor
end if

Sub AddEditor()
    EditorName = fs.GetFileName(MyKey)
    KeyToAdd = "HKCR\.htm\openwithlist\" & EditorName & "\"
    WshShell.RegWrite KeyToAdd,"","REG_SZ"
    KeyToAdd = "HKCR\Applications\" & EditorName & "\shell\edit\command\"
    WshShell.RegWrite KeyToAdd,MyKeySelf,"REG_SZ"

    rtn = msgbox("Added... Do you want to set it as the default HTML Editor?", 36, "Add a HTML Editor")
    if rtn = 6 then
        Call SetAsDefaultEditor
    end if  
end sub

Sub SetAsDefaultEditor()
    On Error resume next
    KeyToAdd = "HKCU\Software\Microsoft\Internet Explorer\Default HTML Editor\shell\edit\command\"
    WshShell.RegWrite KeyToAdd,MyKeySelf,"REG_SZ"
    KeyToAdd = "HKCU\Software\Microsoft\Shared\HTML\Default Editor\shell\edit\command\"
    WshShell.RegWrite KeyToAdd,MyKeySelf,"REG_SZ"
    WshShell.Regdelete "HKCU\Software\Microsoft\Internet Explorer\Default HTML Editor\Description"
    WshShell.Regdelete "HKCU\Software\Microsoft\Internet Explorer\Default HTML Editor\shell\edit\ddeexec\Topic\"
    WshShell.Regdelete "HKCU\Software\Microsoft\Internet Explorer\Default HTML Editor\shell\edit\ddeexec\Application\"
    WshShell.Regdelete "HKCU\Software\Microsoft\Internet Explorer\Default HTML Editor\shell\edit\ddeexec\"
end sub

Set WshShell = Nothing
Set fs = Nothing
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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