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

SignUp Now!

%@EXECSTR[-X,...] generates CLS before execution?

Hi all.

I'd like to know why %@EXECSTR generates a CLS before execution whenever it is invoked with a negative offset.

rem full result:
net statistics workstation
Workstation Statistics for \\this_pc

Statistics since 1 Apr 18.06

Bytes received 4805351517
Server Message Blocks (SMBs) received 345795
Bytes transmitted 9831079902
Server Message Blocks (SMBs) transmitted 345728
Read operations 110038
Write operations 18765
Raw reads denied 0
Raw writes denied 0

Network errors 0
Connections made 2
Reconnections made 0
Server disconnects 1

Sessions started 0
Hung sessions 4
Failed sessions 0
Failed operations 0
Use count 90
Failed use count 0

The command completed successfully.


rem works ok
echo %@execstr[net statistics workstation]
Workstation Statistics for \\this_pc

rem works ok
echo %@execstr[6,net statistics workstation]
Bytes received 4805351517

rem not ok!
echo %@execstr[-2,net statistics workstation]

The command completed successfully.

This is very annoying! And nothing can suppress this, not even >& NUL.
Any ideas?

It doesn't happen here on Win 7/64.

Post your TCSTART.BTM ?
Good one, Charles! CLS in TCSTART.BTM does it here, and only for negative n.

x13, if the point of the CLS is to get rid of the startup copyright message, you can do that with
in the [4NT] section of TCMD.INI.
@EXECSTR will sometimes invoke TCSTART, and sometimes it won't.

If you have a positive offset, @EXECSTR will execute something like this:

(net statistics workstation) >! tempfile

and then read the designated line from the temporary file.

If you have a positive offset, @EXECSTR will execute this:

((net statistics workstation) | tail /n nn) >! tempfile

In the second example, TCC has to invoke another TCC to handle the pipe. The second TCC will run TCSTART and execute your CLS.
I'm very sorry!

There was in fact a CLS in my TCSTART...

But I still don't get why it would only be executed when first %@EXECSTR parameter would be negative.

Anyway, I removed the culprit and this behaviour has stopped.

I never would have thought to look in TCSTART.

My TCSTART generally looks something like this:
@echo off
prompt $P$g
alias /r "%@path[%_cmdspec]aliases.txt"
setdos /i-zip /i-unzip

if %_transient == 1 .or. %_pipe == 1 quit

if plugin fortune if exist "%@path[%_cmdspec]\plugins\quotes.txt" set fortune="%@path[%_cmdspec]plugins\quotes.txt"
cal /3 /h
ver /r

The first part, before the central IF, is executed by all shells. The second part is only for interactive shells.

Similar threads