Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

command line parsing question

Jul
5
0
Hallo,
in a batch file I wanted to show some messages and found a strange behaviour in the output of an echo command. This echo command
echo At %_TIME: T=%_TRANSIENT
displayed
At 14:55:39_TRANSIENT
Without the colon after %_TIME I got the expected
At 14:57:38 T=0

What does the colon do in the echo?
BTW, entering a blank before : does also cure the effect.

This happens with TCC 15.00.33

- Heinz Saathoff
 
Hallo,
in a batch file I wanted to show some messages and found a strange behaviour in the output of an echo command. This echo command
echo At %_TIME: T=%_TRANSIENT
displayed
At 14:55:39_TRANSIENT
Without the colon after %_TIME I got the expected
At 14:57:38 T=0

What does the colon do in the echo?
BTW, entering a blank before : does also cure the effect.

This happens with TCC 15.00.33

- Heinz Saathoff
I believe that You hit the syntax for text replacement.
At http://ss64.com/nt/syntax-replace.html You can find more information.

Regards

Rodolfo Giovanninetti
 
Yes. That is CMD.EXE's syntax for string substitution. You can work around it in TCC by enclosing the variable in []'s:
Code:
echo %[_TIME]: T=%_TRANSIENT
 
Or by supplying a trailing % after the variable:
Code:
echo %_TIME%: T=%_TRANSIENT
 

Similar threads

Back
Top