- May
- 13,141
- 180
The help says (with the word "to" missing)
It's not quite that simple. If the command contains a pipe or redirection, then TIMER's output is piped or redirected, even if a command group is used.
And it would seem that the handling of a command group after TIMER leaves something to be desired.
Backticks help.
If that's the way it should be then the help should make it utterly clear.
Code:
You can optionally specify a command for TIMER run. This is the equivalent of "timer on & command & timer off".
Code:
v:\> timer ( echo foo > foo.txt )
v:\> type foo.txt
Timer 1 on: 12:17:15
foo
Timer 1 off: 12:17:15 Elapsed: 0:00:00.00
Code:
v:\> ( echo foo | grep foo )
foo
v:\> timer ( echo foo | grep foo )
grep: error: Cannot read file )
^C
Backticks help.
Code:
v:\> timer `echo foo > foo.txt`
Timer 1 on: 12:28:04
Timer 1 off: 12:28:04 Elapsed: 0:00:00.00
v:\> type foo.txt
foo