Const tsGigaByte = 109951162776 'Number of physical bytes in one GB strDummyFile = "C:\dummy.bin" 'Location of dummy file to create strDestPath = "E:" 'Destination drive or folder intTestCount = 5 'Number of copy tests to perform and average CreateDummyFile strDummyFile, tsGigaByte 'You can comment this line if the dummy file already exists arrResults = TransferTest(strDummyFile, strDestPath, intTestCount) WScript.Echo CalcSpeed(AverageTime(arrResults), tsGigaByte), "MB/s" Function TransferTest(strFile, ByRef strPath, intCount) 'Performs a transfer speed test for a file copy 'Parameters: string path to test file, string destination, integer test count 'Returns: array of doubles containing test results If InStrRev(strPath, "\") <> Len(strPath) Then strPath = strPath & "\" 'Check for and add trailing slash to path End If arrResults = Array() 'Create blank array to hold results Set objShell = CreateObject("Shell.Application") For i = 0 To intCount - 1 'Loop to perform specified number of tests dteBefore = Timer() 'Snapshot time before copy process objShell.NameSpace(strPath).CopyHere strFile dteAfter = Timer() 'Snapshot time after copy process With CreateObject("Scripting.FileSystemObject") 'Delete the newly created file .DeleteFile .BuildPath(strPath, .GetBaseName(strFile) & "." & .GetExtensionName(strFile)), True End With ReDim Preserve arrResults(i) 'Dynamically re-size array of results arrResults(i) = CDbl(dteAfter - dteBefore) 'Add latest result to array as a double 'WScript.Echo arrResults(i), "seconds" Next TransferTest = arrResults 'Return array of results End Function Function AverageTime(arrTimes) 'Finds the average in a set of values 'Parameters: an array containing numeric values 'Returns: a floating point value with four digit precision For i = 0 To UBound(arrTimes) dblTime = dblTime + arrTimes(i) Next AverageTime = dblTime / (UBound(arrTimes) + 1) 'WScript.Echo AverageTime, "seconds average" End Function Function CalcSpeed(avgTime, intBytes) 'Calculates a speed rating in MB/s 'Parameters: numeric time value in seconds, integer number in bytes 'Returns: a floating point value with four digit precision CalcSpeed = FormatNumber(avgTime * 1024^2 / intBytes, 4) End Function Sub CreateDummyFile(strFile, intBytes) 'Creates a binary file filled with zeros 'Parameters: string path to file, integer file size in bytes Const adTypeBinary = 1 Const adTypeText = 2 Const adSaveCreateNotExist = 1 Const adSaveCreateOverwrite = 2 With CreateObject("ADODB.Stream") .Open .Type = adTypeText For i = 1 To intBytes .WriteText ChrB(0) 'Write a string of Null bytes Next .SaveToFile strFile, adSaveCreateNotExist .Close 'Close and re-open string as binary .Open .Type = adTypeBinary .LoadFromFile strFile .Position = 2 'Read in binary contents, ignore first two bytes added to text file arrBytes = .Read .Position = 0 .SetEOS 'Empty string and write back binary data without extra two bytes .Write arrBytes .SaveToFile strFile, adSaveCreateOverwrite .Close 'File should contain true binary zeros now End With End Sub