以下代码保存成 HTA 文件 文件, 可生成 js 和 vbs 下载者
代码如下 :
<HTA : 응용 프로그램
id = "xmldown"
캡션 = "예"
스크롤 = "자동"
국경 = "없음"
Borderstyle = "정적"
SingleInstance = "예"
maximizebutton = "no"
국경 = "아니오"
iCon = "dxdiag.exe">
<스크립트 언어 = vbs>
서브 window_onload
Window.Resizeto Screen.Width/1.6, Screen.Height/3
Window.moveto 200,200
종료 서브
sub createxml (path, file)
set objstream = createobject ( "adodb.stream")
objstream.type = 1
objstream.open ()
objstream.loadfromfile (경로)
objstream.position = 0
set xmldoc = createobject ( "microsoft.xmldom")
xmldoc.async = false
set root = xmldoc.createprocessingInstruction ( "xml", "version = '1.0'encoding = 'utf-8'")
xmldoc.appendChild (루트)
xmldoc.appendchild (xmldoc.createelement ( "root"))
set xfile = xmldoc.selectsinglenode ( "// root"). AppendChild (xmldoc.createElement ( "file"))
set xstream = xfile.appendChild (xmldoc.createElement ( "stream"))
xstream.setAttribute "XMLNS : DT", "URN : Schemas-Microsoft-Com : Datatypes"
xstream.datatype = "bin.base64"
xstream.nodetypedValue = objstream.read ()
xmldoc.save (파일)
xmldoc = 아무것도 설정하지 않습니다
root = 아무것도 설정하지 않습니다
objstream = 아무것도 설정하지 않습니다
종료 서브
함수 X (OBJ)
set x = document.getElementById (OBJ)
엔드 기능
함수 findfile (str)
set fso = createobject ( "scripting.filesystemobject")
FSO.FileExists (str) 인 경우
findfile = true
또 다른
findfile = false
끝 If
엔드 기능
함수 jsdown ()
set fso = createobject ( "scripting.filesystemobject")
fso.opentextfile ((createobject ( "wscript.shell")). currentDirectory & "/jsdown.js", 2, true)
.write x ( "jsdown"). 값
끝납니다
엔드 기능
함수 vbsdown ()
set fso = createobject ( "scripting.filesystemobject")
fso.opentextfile ((createobject ( "wscript.shell")). currentDirectory & "/vbsdown.vbs", 2, true)
.write x ( "vbsdown"). 값
끝납니다
엔드 기능
</스크립트>
<body>
<H4> 1
选择下载的 exe 文件 : <입력 유형 = 파일 이름 = "file1"id = "file1"size = "20">
保存路径 <입력 유형 = 텍스트 이름 = "path"id = "pathName"value = "c :/down.xml"size = "20">
<입력 유형 = "버튼"value = "生成 xml 文件"onclick = 'vbs : createxml x ( "file1"). value, x ( "pathname"). value : if findfile (x ( "pathname"). 색상 = 빨간색> 生成成功 生成成功, 请传到某个空间 </font> " '> <br>
<H4> 2.> </h4>
<button on click = 'vbs : jsdown () : findfile ( "jsdown.js") = true the the when way msgbox "生成成功": x ( "url"). innerhtml = "用法是 cscript jsdown.js xmlurl savepath"' '> 生成 js 下载者 下载者 </button> <vbs :'vbsdown () : findfile () : if findfile (findfile). = true then msgbox "生成成功": x ( "url"). innerhtml = "<font color = blue> 用法是 cscript vbsdown.js xmlurl savepath </font>" '> vbs 下载者 </button> <br> <br> <br> <br>