• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1532
  • Last Modified:

Help capturing timeit output

Hello -

I have the following batch command

timeit copy C:\pic.jpg z:\ /y

using basic > output.log, etc.. I am not able to capture the data output of timeit (provides timing info for my copy command) - any ideas?

Thanks
Rich
0
newtontech4
Asked:
newtontech4
1 Solution
 
ghostdog74Commented:
when you type :timeit copy C:\pic.jpg z:\ /y on the command line, what did you see? what happens?
0
 
oBdACommented:
TimeIt.exe writes, for whatever reason (probably so as not to interfere with the output of the command it's running) to stderr.
You can capture the output in a log file by redirecting stderr to the log file:

timeit whatever.exe 2>ouput.log
0
 
newtontech4Author Commented:
hi ghostdog74
Here is the output of the command -  notice since timeit is a windows resource utility I run it and my batch from it's home directory...

C:\Program Files\Windows Resource Kits\Tools>timeit copy.bat

C:\Program Files\Windows Resource Kits\Tools>copy C:\pic.jpg z:\ /y
        1 file(s) copied.

Version Number:   Windows NT 5.1 (Build 2600)
Exit Time:        9:22 am, Friday, October 12 2007
Elapsed Time:     0:00:00.390
Process Time:     0:00:00.031
System Calls:     4294
Context Switches: 2454
Page Faults:      788
Bytes Read:       1752298
Bytes Written:    775200
Bytes Other:      108340
0
Free recovery tool for Microsoft Active Directory

Veeam Explorer for Microsoft Active Directory provides fast and reliable object-level recovery for Active Directory from a single-pass, agentless backup or storage snapshot — without the need to restore an entire virtual machine or use third-party tools.

 
newtontech4Author Commented:
Hi oBdA -

Thanks for your feedback.  I am hoping you can elaborate a little more.

I noticed that the timeit sends output to it's own dat file - which for the life of me I have no idea how to read.

Thanks
Rich
0
 
MSE-dwellsCommented:
TIMEIT's .DAT file is binary encoded but it's really not necessary for us to read it in order to do as you require, try this command in your batch file -

for /f "tokens=3-5 delims=. " %%t in ('timeit 2^>^&1 copy C:\pic.jpg z:\ /y ^| find /i "Elapsed"') do set timeTAKEN=%%t.%%u

oBdA was correct in that TIMEIT writes to stderr.  The notion of text handling at the command prompt is divided into 3 possible data streams known as stdout, stderr and stdin (standard out, standard error and standard in).  Non-error related messages should, according to convention, be written by the application to stdout while errors should be written to stderr.  Input is accepted from stdin.  stdout can be redirected using the following syntax -

dir 1> MYoutput.txt (or abbreviated to dir >MYoutput.txt)

... while errors can be redirected using -

cd THISdoesNOTexist 2> hereISmyERROR.log

The '1' and '2' prefixing the '>' symbol allow us to designate stdout or stderr redirection respectively.  To redirect stdin, i.e. accept input from somewhere other than the keyboard, use a '<' symbol typically followed by a filename containing the text we'd like entered as automated input.

The special syntax '2>&1' tells the command shell to send stderr through the same output stream as stdout allowing a script to capture both the stdout and stderr output steams in one pipeline.

The '^' symbol you see me using in the example I provided prevents the command prompt from applying the redirection or piping components too early in the execution of the statement.
0
 
newtontech4Author Commented:
Thanks to all for your contributions on this.

I have decided to run with robocopy - the following works like a charm.
robocopy "C:\1" "C:\2" /MIR /COPYALL /V /NC /NDL /NP /NFL /LOG:"C:\MYLOGFILE.log" /R:10 /W:30 /ETA

Thanks
0
 
Computer101Commented:
PAQed with points refunded (500)

Computer101
EE Admin
0

Featured Post

Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now