0

I'm trying to code a DLL updater that just copies the new versions of some already existant DLL files to my working folder. This is just to keep the DLLs updated as my coleagues release new versions.

This is the code I came up with after reading some tutorials.

Dim strSourceFolder, strDestFolder
strSourceFolder = "C:\Users\myName\Desktop\Win64"
strDestFolder = "C:\Program Files\Common Files\Company\Pruebaupdater"

For Each file In StrSourceFolder
    If File.Type = "dll" Then
        ReplaceIfNewer
    End If
Next

Sub ReplaceIfNewer (SourceFile, DestFolder)
    Dim filesys, demofile, date1, date2
    Set filesys = CreateObject("Scripting.FileSystemObject")
    Set demofile = filesys.GetFile("filename1")
    date1 = demofile.DateLastModified
    demofile = filesys.GetFile("filename2")
    date2 = demofile.DateLastModified

    If DateDiff("d", date1, date2) > 0 Then
        **copy SourceFile** to SourceFolder
    End If
End Sub

When the script reaches the copy function, I get an 800A0401 at line 21 character 20 - End of instruction expected. This copy function is right the same in every bit of code I've seen.

One of my sources is this and there's no comment there as of the copy function, so I guess this works for them.

Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328
Hector
  • 21
  • 1
  • 6
  • 1
    What is exactly inside of `if datediff..`? `copy SourceFile to SourecFolder`? There's no such native function in vbs. – montonero Jun 03 '19 at 10:00
  • 1
    The question from where you copied the code expressly states that it is *pseudocode*. One of the answers links to the VBScript documentation about working with `FileSystemObject` instances. Please start there. – Ansgar Wiechers Jun 03 '19 at 10:38

0 Answers0