then execute it by using: Server.CreateObject("WScript.Shell")
Here is my example:
strSourcePath = "\\webserver\ Set fso = CreateObject("Scripting.FileSystemObject")
Set objTxtFile = fso.CreateTextFile (Server.MapPath("\gripanet\uploadtxtfile\ftpsend.txt"))
' Write the Header
objTxtFile.writeline( "ftp" )
objTxtFile.writeline( "open myweb.com" )
objTxtFile.writeline( "username" )
objTxtFile.writeline( "password" )
objTxtFile.writeline( "cd images" )
objTxtFile.writeline( "cd pdf" )
Set conn = createobject("adodb.connection")
conn.open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=username;Password=password;Initial Catalog=GRIPANET;Data Source=iisserver"
Set rsGetPDFS = Server.CreateObject("ADODB.Recordset")
rsGetPDFS.Open "exec usp_getpdfs ", conn, 3, 3
' Determine if there are any records
If Not rsGetPDFS.EOF Then
'Loop through records
Do While Not rsGetPDFS.EOF
objTxtFile.writeline( "put " & strSourcePath & "\" & rsGetPDFS("FileName") & "")
rsGetPDFS.MoveNext
Loop
'End the If record exists
END IF
'END THE FTP SESSION
objTxtFile.writeline( "close" )
objTxtFile.writeline( "quit" )
objTxtFile.writeline( "exit" )
'***************** Read
Set textStreamObject = fspenTextFile(Server.Mappath("\gripanet\uploadtxtfile") & "\ftpsend.txt",1,false,0)
Response.Write textStreamObject.ReadLine
Set objShell = Server.CreateObject("WScript.Shell")
objShell.Run("cmd.exe")
Is there a way to now read this file and execute it using WScript.Shell ?
Also is there a way to do this that may not involve even writing the file? If so does it make more sense to do?
Here is my example:
strSourcePath = "\\webserver\ Set fso = CreateObject("Scripting.FileSystemObject")
Set objTxtFile = fso.CreateTextFile (Server.MapPath("\gripanet\uploadtxtfile\ftpsend.txt"))
' Write the Header
objTxtFile.writeline( "ftp" )
objTxtFile.writeline( "open myweb.com" )
objTxtFile.writeline( "username" )
objTxtFile.writeline( "password" )
objTxtFile.writeline( "cd images" )
objTxtFile.writeline( "cd pdf" )
Set conn = createobject("adodb.connection")
conn.open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=username;Password=password;Initial Catalog=GRIPANET;Data Source=iisserver"
Set rsGetPDFS = Server.CreateObject("ADODB.Recordset")
rsGetPDFS.Open "exec usp_getpdfs ", conn, 3, 3
' Determine if there are any records
If Not rsGetPDFS.EOF Then
'Loop through records
Do While Not rsGetPDFS.EOF
objTxtFile.writeline( "put " & strSourcePath & "\" & rsGetPDFS("FileName") & "")
rsGetPDFS.MoveNext
Loop
'End the If record exists
END IF
'END THE FTP SESSION
objTxtFile.writeline( "close" )
objTxtFile.writeline( "quit" )
objTxtFile.writeline( "exit" )
'***************** Read
Set textStreamObject = fspenTextFile(Server.Mappath("\gripanet\uploadtxtfile") & "\ftpsend.txt",1,false,0)
Response.Write textStreamObject.ReadLine
Set objShell = Server.CreateObject("WScript.Shell")
objShell.Run("cmd.exe")
Is there a way to now read this file and execute it using WScript.Shell ?
Also is there a way to do this that may not involve even writing the file? If so does it make more sense to do?