Command I'm using is
Code: Select all
xcopy C:\Records\ \\Server Name\Directory Name\All Records\ /f /l /i /s /y /z
For some reason this is not working, CMD window is just blinking and closing
I am Generating this code through a VBA Macro from MS Excel
Macro Code is
Code: Select all
Sub CopyFiles()
Dim fs As Scripting.FileSystemObject
Dim file As TextStream
Dim retVal
Dim strFilePath, FSource, FDestination As String
strFilePath = "C:\Test\"
StrFile = "CopyFiles.bat"
FSource = wksList.Range("D4").Value '(this is C:\Records)
FDestination = wksList.Range("D4").Value '(this is \\Server Name\Directory Name\All Records)
Set fs = New Scripting.FileSystemObject
Set file = fs.CreateTextFile(strFilePath & StrFile)
file.WriteLine ("xcopy " & FSource & "\*.* " & FDestination & "\ /i /e /y")
file.Close
retVal = Shell(strFilePath & StrFile)
End Sub
Is there any way to process this in DOS