The batch file reads a text file that has all of the ftp commands to get a
file. When I run the batch manually everything goes great. When I try to run
it from script it fails.
It appears that I am having a permissions problem. Does anyone have a simple
asp page that shows how to accomplish this on Windows XP or Windows Server
2003?
I am guessing that WSH 5.6 has changed enough from the previous version to
cause me grief.
Thanks for any help.
but you can do it from asp.net page
http://dev.thatsit.net.au/samples/aspnet/priveleges/default.aspx
"Tritt" <Tr...@discussions.microsoft.com> wrote in message
news:4487BE29-7A19-40F7...@microsoft.com...
take a look at this:
http://blogs.msdn.com/david.wang/archive/2006/04/28/HOWTO-Run-Console-Applications-from-IIS6-on-Windows-Server-2003-Part-2.aspx
how to : create a cgibin folder
http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/6d1bbdf7-1834-4ccd-862d-e4dc7587f314.mspx?mfr=true
now some sample code whch worked fine on my IIS6(W2K3 SP2)
<%
Dim oFSO, oTextFile, oShell
Dim oFileSys, oFile, cCMD, nretval
Dim strTempFile, strCommandResult
Dim ftp_address, ftp_username, ftp_password
Dim ftp_physical_path, ftp_files_to_get
' Edit these variables to match your specifications
server_adress = "xxxx.xxx.com"
ftp_address = "ftp.microsoft.com"
ftp_username = "anonymous"
ftp_password = "ds...@prima.de"
ftp_remote_directory = "/ResKit/IIS4/"
'futures ="" ' Leave blank if uploading to root directory
'(e.g. *.txt)
ftp_files_to_get ="Permchk.exe"
Set oShell = Server.CreateObject("WSCRIPT.SHELL")
Set oFileSys = Server.CreateObject("Scripting.FileSystemObject")
Set oFSO= CreateObject("Scripting.FileSystemObject")
' Build our ftp-commands file
Set oTextFile = oFSO.CreateTextFile(Server.MapPath("test.ftp"))
oTextFile.WriteLine "open " & ftp_address
oTextFile.WriteLine ftp_username
oTextFile.WriteLine ftp_password
oTextFile.WriteLine "lcd " & Server.MapPath(".")
oTextFile.WriteLine "cd " & ftp_remote_directory
' Check to see if we need to issue a 'cd' command
If ftp_remote_directory <> "" Then
oTextFile.WriteLine "cd " & ftp_remote_directory
End If
' If the file(s) is/are binary (i.e. .jpg, .mdb, etc..),
'uncomment the following line
oTextFile.WriteLine "binary"
' If there are multiple files to get, we need to use the command
'mget', instead of 'get'
If Instr(1, ftp_files_to_get, "*",1) Then
oTextFile.WriteLine "mget " & ftp_files_to_get
Else
oTextFile.WriteLine "get " & ftp_files_to_get
End If
oTextFile.WriteLine "bye"
oTextFile.Close
'Set oTextFile = Nothing
' Use cmd.exe to run ftp.exe, parsing our newly created command file
cCMD = "ftp.exe -s:" & Server.MapPath("test.ftp") & ""
strTempFile = Server.MapPath("test.out")
If Not oFileSys.FileExists(strTempFile) Then
Set oFile = oFileSys.CreateTextFile(strTempFile)
oFile.Close
End If
On Error Resume Next
' Pipe output from cmd.exe to a temporary file (Not :| Steve)
cmdString = "cmd.exe /c " & cCMD & " > " & strTempFile
nretval = oShell.Run (cmdString, 0, True)
Set oFile = oFileSys.OpenTextFile (strTempFile, 1, False, 0)
'Grab output from temporary file
strCommandResult = Server.HTMLEncode( oFile.ReadAll )
oFile.Close
' Delete the temporary & ftp-command files
'Call oFileSys.DeleteFile( strTempFile, True )
'Call objFSO.DeleteFile( Server.MapPath("test.ftp"), True )
Set oFile = Nothing
Set oFileSys = Nothing
Set oFSO= Nothing
Set oShell = Nothing
%>
<%=strCommandResult%>
Greetings from Germany
Dirk
"Tritt" <Tr...@discussions.microsoft.com> schrieb im Newsbeitrag
news:4487BE29-7A19-40F7...@microsoft.com...
WHAT exactly DOES it do ?