Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
Solved

# vbs script to copy file to another computer and test speed/time

Posted on 2011-10-05
Medium Priority
442 Views
Hi,
Does anyone know of a vb or similar script that i can use to copy a file from one computer to another and then report how long it took and the speed it took?

It would be great if the script would ask me the location of the computer that I want to copy the file to (example \\computer\shared_folder)

it would also be great if it could output the time it took and speed it took to a log file like C:\folder\speed_test.log
0
• 4
• 4

LVL 59

Expert Comment

ID: 36920830
Why not just use ROBOCOPY for this test, it gives you those type of stats.

For example, doing this:

robocopy . g:\ large.txt

I got this:

-------------------------------------------------------------------------------
ROBOCOPY     ::     Robust File Copy for Windows
-------------------------------------------------------------------------------

Started : Wed Oct 05 17:02:33 2011

Source : c:\ee\
Dest : g:\

Files : large.txt

Options : /COPY:DAT /R:1000000 /W:30

------------------------------------------------------------------------------

1    c:\ee\
100%        New File               9.5 m        LARGE.TXT

------------------------------------------------------------------------------

Total    Copied   Skipped  Mismatch    FAILED    Extras
Dirs :         1         0         1         0         0         0
Files :         1         1         0         0         0         0
Bytes :    9.53 m    9.53 m         0         0         0         0
Times :   0:00:01   0:00:01                       0:00:00   0:00:00

Would be easy to put that in a BAT file and use PROMPT to ask for the computer name to copy to, let me know if you need help with that.

~bp
0

Author Comment

ID: 36920959
if you wouldnt mind doing that, i would greatly appreciate it. I dont know much about coding.
0

Author Comment

ID: 36920976
actually after looking into robocopy, that won't work for windows Server 2003 since its not part of the standard features.

is there another way of doing it?
0

LVL 59

Expert Comment

ID: 36920993
Can you download it from the resource kit and place it on the server?

~bp
0

Author Comment

ID: 36921014
Ya i can do that. I bet i could setup the script so if robocopy is not installed i could download it,and then have it run the command?

what do i need to do to use the prompt feature to ask for the computer name and location?
0

LVL 59

Accepted Solution

Bill Prew earned 2000 total points
ID: 36921645
Hope this makes sense, it will prompt for the destination computer and folder path and then do the copy.  It will display the results to the screen, and also save it to a logfile.  Update the SETs at the top of the script as needed.  Save as a BAT file.

@echo off

REM Define folders and files to be used for copy and logging
set BaseDir=c:\basefolder
set TestFile=testfile.txt
set LogFile=logfile.txt

REM Prompt for computer name
set Computer=
set /P Computer=Enter computer name:

REM If a computer name was entered, do the timing test
if defined Computer (
robocopy "%BaseDir%" "%Computer%" "%TestFile%" /TEE /LOG:"%LogFile%"
)

~bp
0

Author Closing Comment

ID: 37001824
this worked perfectly!
0

LVL 59

Expert Comment

ID: 37002073
Great, glad that helped, thanks for the feedback.

~bp
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Script to copy or move mouse-selected collection of files plus targets referenced by shortcuts (.lnk) The purpose of this article is to help illuminate the real challenges and options available (where they may exist) for utilizing simple scriptin…