Write a basic HTA

Originally created by a coworker: http://joshuasmueller.wordpress.com/2009/08/13/write-a-basic-hta/.

What does this do?
The code below will create a basic HTA that has a link to open Notepad.

<html>
<head>
<HTA:APPLICATION ID=”oHTA”
VERSION=”1.0″
APPLICATIONNAME=”AmPost”
BORDER=”thin”
BORDERSTYLE=”normal”
CAPTION=”yes”
CONTEXTMENU=”no”
ICON=””
INNERBORDER=”yes”
MAXIMIZEBUTTON=no”
MINIMIZEBUTTON=”no”
NAVIGABLE=”yes”
SCROLL=”no”
SCROLLFLAT=”yes”
SELECTION=”yes”
SHOWINTASKBAR=”yes”
SINGLEINSTANCE=”yes”
SYSMENU=”Yes”
WINDOWSTATE=”normal”
/>
<script language=”VBScript”>
Dim objShell
Sub Run(Name)
Set objShell = CreateObject(“WScript.Shell”)
objShell.Run Name
On Error Resume Next
Set objShell = Nothing
End Sub
</script>
</head>
<body bgColor=”black”>
<!– Launch Notepad, for example –>
<font color=”white” onClick=”javascript:Run(‘file://c:/Windows/notepad.exe’);” style=”cursor: hand;”><u>Notepad</u></font>
<br>
</body>
</html>

, , ,

  1. Leave a comment

Leave a comment