; initialize array of computer names
$FourthAveArray = "ftran1", "ftran2", "ftran3", "SPARE", "FACCTG8", "FACCTG1", "FACCTG2"
; enumerate the array
For Each $Element In $FourthAveArray
; Get the current millisecond count - not good as this is the MSec portion of the current minute
; $Time = @msec
; Get the current millisecond count - not good as this is the MSec portion of the current minute
$Time = @TICKS
; copy the source to dest - quotes were missing
; copy c:\fspcopy\*.mdb "\\"+$Element+"\c$\fsp\mdb" /c /r
; with quotes, and spaces to improve readability - will still fail because "\c$\..." is
; interpreted as a variable "$", which isn't defined. The strings is interpreted as
; "\c\fsp...", which is not valid
; copy "c:\fspcopy\*.mdb" "\\" + $Element + "\c$\fsp\mdb" /c /r
; corrected copy string - better would be to use Chr(36), or SetOption("NoVarsInStrings", "On")
copy "c:\fspcopy\*.mdb" "\\" + $Element + "\c$$\fsp\mdb" /c /r
IF @ERROR <> 0
; best practice - enclose string in quotes - "append" is the default - not needed
; also - capture the return codes, and close the redirection
; REDIRECTOUTPUT (failure.txt, 0)
$RC=RedirectOutput('failure.txt')
; "?" is not a print statement - it's a CR/LF.. should come AFTER the message
; ? $Element
$Element ' - ' @SERROR ?
$RC=RedirectOutput('')
Endif
; get elapsed time for this process - corrected to use TICKS
$Time = @TICKS - $Time
Next