Option Explicit ' Written by Eric Phelps ' http://www.ericphelps.com ' Uploads designated files. Dirt-simple. No archive bit checking. It uploads everything ' every time. ' You must hard-code all four values listed in the "User info"" section and hard-code ' all file names, their transfer type, and their destinations in the "Identify files to upload" section. ' You must also delete or comment the below "MsgBox" line to actually run the script! MsgBox "This script must be edited! It is designed to be run with no user interaction!" : Wscript.Quit 1 On Error Resume Next Main Sub Main() On Error Resume Next 'Declare objects Dim wsh 'As Wscript.Shell Dim tsScript 'As Scripting.TextStream Dim fs 'As Scripting.FileSystemObject 'Declare variables Dim strRemoteSite 'As String Dim strUserName 'As String Dim strPassword 'As String Dim intWindowStyle 'As Integer Dim strFtpScriptFileName 'As String 'Define constants Const TemporaryFolder = 2 Const WshHide = 0 Const WshNormalFocus = 1 Const WshMinimizedFocus = 2 Const WshMaximizedNoFocus = 3 Const WshNormalNoFocus = 4 Const WshMinimizedNoFocus = 6 '''''''''' Create needed objects Set wsh = CreateObject("Wscript.Shell") Set fs = CreateObject("Scripting.FileSystemObject") '''''''''' Set initial values strFtpScriptFileName = fs.BuildPath(fs.GetSpecialFolder(TemporaryFolder), fs.GetBaseName(Wscript.ScriptFullName) & ".script") '''''''''' User info '''''''''''''''''''''' strPassword = "ieuser" 'FTP server password strUserName = "anonymous" 'FTP server user name strRemoteSite = "ftp.microsoft.com" 'FTP server machine name intWindowStyle = WshNormalFocus 'Just how visible? Use any Wsh constant defined above ' CAUTION: If intWindowStyle is set to WshHide and user needs a dial-up connection, the dial-up ' dialog will be hidden, effectively hanging the program. If the connection is dialed before this ' program is run, there is no problem. Likewise no problem if user is on a LAN. '''''''''' Set the window style If Lcase(Right(Wscript.FullName, 11)) = "wscript.exe" Then 'Running under WSCRIPT If intWindowStyle <> WshHide Then 'Need to switch to CSCRIPT Wscript.CreateObject("Wscript.Shell").Run "cscript.exe """ & Wscript.ScriptFullName & """", intWindowStyle Wscript.Quit End If End If '''''''''' Start output script Set tsScript = fs.CreateTextFile(strFtpScriptFileName, True) tsScript.WriteLine "open " & strRemoteSite tsScript.WriteLine strUserName tsScript.WriteLine strPassword tsScript.WriteLine "hash" '''''''''' Identify files to upload 'Just make a pair like the two examples below for every file you want to upload. tsScript.WriteLine "ascii" tsScript.WriteLine "put " & """C:\Autoexec.bat"" " & "/users/john.doe/www/MyAutoexec.txt" tsScript.WriteLine "binary" tsScript.WriteLine "put " & """C:\Program Files\Accessories\HyperTerminal\CompuServe.ht"" " & "/users/john.doe/www/compuserve.ht" '''''''''' Run the FTP script tsScript.WriteLine "bye" tsScript.Close Set tsScript = Nothing If fs.FileExists(fs.GetSpecialFolder(1) & "\ftp.exe") Then wsh.Run fs.GetSpecialFolder(1) & "\ftp.exe -s:""" & strFtpScriptFileName & """", intWindowStyle, True Else wsh.Run fs.GetSpecialFolder(0) & "\ftp.exe -s:""" & strFtpScriptFileName & """", intWindowStyle, True End If 'wsh.Run "%windir%\ftp.exe -s:""" & strFtpScriptFileName & """", intWindowStyle, True fs.DeleteFile strFtpScriptFileName End Sub