Hello
I am using the following to copy a dir from a network drive to a local computer. It works fine without declaring variables. The problem is if I declare the variables (and replace Wscript.Arguments and Wscript.Arguments.Count with those variables) I get a "subscript out of range" message. Can Someone tell me what I am doing wrong.
Thanks in Advance
'Option Explicit
Const OverWriteFiles = True
'Dim sFolder
'Dim dFolder
'Dim args
'Dim objFSO
'sFolder = Wscript.Arguments(0)
'dFolder = Wscript.Arguments(1)
'args = Wscript.Arguments.Count
IF Wscript.Arguments.Count < 2 THEN
Wscript.Echo "Syntax is: cscript CopySp3.vbs SourceDir DestinationDir"
Wscript.Quit
End IF
Set objFSO = CreateObject("Scripting.FileSystemObject"
objFSO.CopyFolder Wscript.Arguments(0) , Wscript.Arguments(1) , OverWriteFiles
I am using the following to copy a dir from a network drive to a local computer. It works fine without declaring variables. The problem is if I declare the variables (and replace Wscript.Arguments and Wscript.Arguments.Count with those variables) I get a "subscript out of range" message. Can Someone tell me what I am doing wrong.
Thanks in Advance
'Option Explicit
Const OverWriteFiles = True
'Dim sFolder
'Dim dFolder
'Dim args
'Dim objFSO
'sFolder = Wscript.Arguments(0)
'dFolder = Wscript.Arguments(1)
'args = Wscript.Arguments.Count
IF Wscript.Arguments.Count < 2 THEN
Wscript.Echo "Syntax is: cscript CopySp3.vbs SourceDir DestinationDir"
Wscript.Quit
End IF
Set objFSO = CreateObject("Scripting.FileSystemObject"
objFSO.CopyFolder Wscript.Arguments(0) , Wscript.Arguments(1) , OverWriteFiles