TIMER command

May 20, 2008
11,401
99
Syracuse, NY, USA
The help says (with the word "to" missing)
Code:
You can optionally specify a command for TIMER run. This is the equivalent of "timer on & command & timer off".
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.
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
And it would seem that the handling of a command group after TIMER leaves something to be desired.
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
If that's the way it should be then the help should make it utterly clear.
 

rconn

Administrator
Staff member
May 14, 2008
12,345
150
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.

That's not a command group; that's an argument to a command that happens to include some meaningless parentheses and output redirection. If you want to have it treated like a command group, you have to protect the entire argument string with back quotes.

Only the conditional commands (DO, IF, IFF, and FOR) accept trailing command group arguments.
 
May 20, 2008
11,401
99
Syracuse, NY, USA
That's not a command group; that's an argument to a command that happens to include some meaningless parentheses and output redirection. If you want to have it treated like a command group, you have to protect the entire argument string with back quotes.

Only the conditional commands (DO, IF, IFF, and FOR) accept trailing command group arguments.
OK. I was expecting it to work like DO.
I don't **need** a command group. I only wanted the redirection/pipe to work correctly. That can be done by escaping the redirection/pipe character.
 
Similar threads
Thread starter Title Forum Replies Date
vefatica TIMER command Support 9
B Two Issues With TIMER Command In V14 Support 10
Joe Caverly PAUSE does not erase countdown timer Support 0
vefatica @TIMER's format ... Support 2
samintz Timer issue Support 4
vefatica TIMER causes confusion Support 2
vefatica @TIMER's second parameter? Support 3
vefatica TIMER off by factor of 10 (or even 100) Support 4
J TCC 25 @TIMER regession Support 4
jbanaszczyk %@Timer Support 1
D TIMER OFF doesn't work Support 21
H TIMER bug Support 4
gunkelkarl timer ? Support 3
Dmitry L. Kobyakov How to? How to remove the record of the old version of the Take Command? Support 5
D Can alias pass parameters to for command? Support 3
samintz How to? Search for %(command) in Help? Support 1
T VIEW only works from command line Support 14
rconn News Take Command / TCC / CMDebug / TCC-RT v28 Released Support 0
T Take Command 28: Lua reports version 5.4.0 (5.4.3 expected) Support 0
Jay Sage WAD Possible Bug With OPTION Command With @FILE Support 5
rconn News Take Command / TCC / CMDebug / TCC-RT 27.01.24 uploaded Support 0
J Take command does not start on Windows 10 Support 3
vefatica `Back quotes` - command line vs. batch file Support 5
Jay Sage WAD Failure of Alias Command with /Z Option Support 14
Phileosophos Is there any way to open the Take Command options dialog from the command line? Support 8
Phileosophos Command-line Editing Shortkeys That Fail Support 6
fpefpe How to? free (internal) command Support 0
rconn News Take Command / TCC / CMDebug / TCC-RT 27.01.23 uploaded Support 0
T How to? retain command history across reboot? Support 6
rconn News Take Command / TCC / CMDebug / TCC-RT v27.01 Build 22 Uploaded Support 0
Jay Sage Bug With Flow Control and/or Command Grouping Support 2
GermanDirk How to? EVENTLOG Command with simple User Rights not functional Support 4
Jay Sage Take Command Is Too Fast! Support 4
Jay Sage Comparison of IF with Command Group and IFF Support 6
D Open Windows 10 Photos app from command line Support 11
rconn News Take Command / TCC / CMDebug / TCC-RT 27.0.21 uploaded Support 0
rconn News Take Command / TCC / CMDebug / TCC-RT 27.0.20 uploaded Support 0
U Can not get/start Take Command gui Support 1
rconn News Take Command / TCC / CMDebug / TCC-RT 27.0.19 Support 0
S Increasing Font Point Size in Command Tabs Support 2
mfarah Fixed The DATE command produces the wrong error message. Support 1
vefatica Command name mix-up Support 3
FreezerBurnt "Missing SETLOCAL" when initializing Visual Studio Command Prompt. Support 9
E How to? Closing desktop created by DESKTOP command Support 10
rconn News Take Command / TCC / CMDebug / TCC-RT v27.0.18 Support 0
K Take Command fox XP? Support 7
Joe Caverly Documentation Replace internal command with LIBRARY command Support 0
fpefpe How to? command echo in title line/bar Support 2
U Command help on file names Support 5
vefatica Command line DO with no closing parenthesis? Support 9

Similar threads