WAD Possible Bug in Batch Parameters

Jun 2, 2008
376
2
Newton, MA
The help file says that the special character string %* represents, and I quote: "the complete command tail, unmodified by SHIFT". However, the following batch file

echo The number of arguments is %#
echo Command tail is :%$:
echo Command tail is :%*:​

when run with the argument "test" (without the quotes) produces the following output:

echo The number of arguments is %#
echo Command tail is :%$:
echo Command tail is :%*:​

WHOA! That's not what it produces. That's what copying and pasting from the TCMD17 screen produces (another bug?). Here's what I actually see on the screen:

echo The number of arguments is 1
echo Command tail is :test:
echo Command tail is :*:
So it appears that "%*" is not working. For me, it doesn't seem to be working in version 16 either.

-- Jay
 
Dec 7, 2009
238
2
Left Coast, USA
FWIW...I'm still using v.15 -- I'm always slow to update -- and get unexpected results (like yours) with the statement containing %* when I use colons or single quotes (apostrophes, not back-quotes). I get the expected results when I use double quotes. (Talking about what the .btm file echoes to the terminal. I didn't also try copying and pasting from the screen.)
 
May 20, 2008
11,391
99
Syracuse, NY, USA
Code:
echo Command tail is :%*:

That doesn't work in any TCC back to v11. But it does work if you remove the second ':'.

It also fails with any of these after the '*' ... *, \, !, @, #, $, %%, a-z, A-Z ... but /, (, and ) are OK.

I didn't try others.
 
May 20, 2008
11,391
99
Syracuse, NY, USA
Jay, are you sure the copy error wasn't you ... copying the TYPEd file in TCMD? If you copied
Code:
echo The number of arguments is 1
echo Command tail is :test:
echo Command tail is :*:
and got
Code:
echo The number of arguments is %#
echo Command tail is :%$:
echo Command tail is :%*:
that would be one hell of a bug!
 

rconn

Administrator
Staff member
May 14, 2008
12,340
149
%* works fine, provided you don't append a colon. The only valid characters following a %* are a space, tab, ", |, <, >, {, }, (, ), ;, +, =, /, and '. Anything else stops the %* processing. (A colon is a particularly bad choice as a delimiter character, as it has a special meaning as a drive designator.)

%* is normally used at the end of a command line, or in a command group. What purpose did you have in enclosing it in colons?

I do not understand what you're saying about the cut & paste.
 
May 20, 2008
11,391
99
Syracuse, NY, USA
Rex, can you tell us exactly what's happening there, and below? Is there some general principle involved?
Code:
v:\> echo %*
ECHO is OFF

v:\> echo :%*:
:*:
 
Jun 2, 2008
376
2
Newton, MA
Jay, are you sure the copy error wasn't you ... copying the TYPEd file in TCMD?

Maybe that is what happened. I selected the text in the TCMD window and used Ctrl-C to copy it, but maybe the copy failed, leaving the previous contents of the clipboard unchanged. As I think about it now, what I thought I saw is highly unlikely!

Rex, I was just trying to test the %* parameter and put some characters around it so I could see if any spaces were introduced. I had tried other characters with the same result. All this started when real code failed to work. That code may have had a command separator after the %* without any spaces.

A lot of my aliases and batch files are giving me trouble under version 17, and I have been forced to do a lot of editing. Things that worked before, even if they were illegal or discouraged, do not work now. One example is the use of %+ as a configuration-invariant command separator. For years in Z System (ZCPR) in the 8-bit world and in Unix I was used to using the semicolon as a command separator, and I continued to do so in TCC. I have finally bitten the bullet, accepted the default configuration, and converted my alias definitions. I still have to check all the batch files. This is painful, but it had to be done at some point.

-- Jay
 
Similar threads
Thread starter Title Forum Replies Date
Jay Sage WAD Possible Bug With OPTION Command With @FILE Support 5
I Possible Bug: History /n Returns Nothing Support 3
noahcoad Possible Bug? Launching 4nt.exe Goes Hairwire Support 10
G possible bug in SETDOS Support 4
M Is bash-like filename completion possible? Support 3
vefatica DO /P ... is this possible ... ? Support 5
M @FileSize - How is this possible? Support 10
S Is restartable TCMD download possible? Support 6
H Possible V16 documentation error? Support 2
The Wizard WAD Possible Incorrect COMSPEC handling Support 2
S How to? Is it possible for the IDE to start without plugins? Support 3
A How to? Is it possible to freeze one side of the console? Support 19
Vasilich How to? debugging files that use CALL command - possible?? Support 3
wbiebel Can this be possible: TCEXIT is not executed? Support 21
Frank VIEWing multiple files possible? Support 4
daniel347x Is it possible to send a line from the "command input" window to the tab without pressing "Enter", w Support 4
C Possible caching problem with http files Support 7
S Dir - case selection possible?? Support 3
T Possible to delete the new standard tab? Support 1
M Something that does not seem possible... Support 2
D Is this possible, and how Support 0
Dick Johnson v28 Cosmetic Bug Support 0
R strange bug? Support 7
Jay Sage Bug With Flow Control and/or Command Grouping Support 2
M Server 2019 Bug with @execstr? Support 14
R bug _ypixels in BDEBUGGER Support 6
E Fixed Bug with DIR /Z displaying descriptions Support 8
E Text copy bug Support 1
x13 SETARRAY /Z bug Support 6
Gamegod ffind bug with chinese Support 2
Dick Johnson cdd - is this a bug or a feature? Support 7
P "Set" command behavior - a bug? Support 3
nikbackm TCC 20 variable expansion bug Support 6
gentzel Bug launching external commands in 20.11.43 Support 11
R Is this a bug in SETARRAY? Support 2
M Windows Installer bug? Support 4
vefatica @SCRIPT bug persists Support 4
M Little bug, big consequences .. Support 6
fishman@panix.com Once again the Can't Install bug bites... Support 2
gentzel Fixed dirs +n bug in 20.0.12 x64 Support 2
M Bug in Windows 10, when adding symbol to task bar Support 6
Alpengreis [Bug?] View (V) Prefs Error (TC 18.00.27 x64) Support 4
D WAD Minor Post Installation Bug in V18 Support 1
samintz WAD Weird REN bug Support 6
G Bug? TCC 16.03.55 Console Palette Support 4
S Return of FTP copy bug in 16.02.48 Support 12
S XenForo bug Support 3
D TCMD16 Delete Toolbar Button bug Support 7
keithg1964 WAD 16.0027 Alias /rz bug Support 8
rfaquino WAD Apparently a bug when expanding environment variable %ProgramFiles(x86) Support 2

Similar threads