Why does this code produce these results?

May 24, 2010
Northlake, Il
And, more importantly, what can I do about it? The code in question (which has been extracted and cut down from the actual code in question to illustrate the problem) is contained in the attached zip file. And the results of running that code are also in the attached zip file. I apologize for the inconvenience that that causes, but when I put the code (important part being %Index[%CharSetInstr[%I,1,%CharSet]]) inline in a CODE section in this posting, it gets "decorated" for reasons I totally don't understand with open and close EMAIL tags.
So if you look at the (very simple!) code and the (also vey simple!) resulting output, you will see that the code is completely unable to handle the open parenthesis properly. Frankly, I really don't understand (nor care, when you come right down to it) what the open parenthesis means in these circumstances. I just know that the data that I will ultimately be processing will contain open parenthesis.


  • Sample.zip
    653 bytes · Views: 67
May 20, 2008
Elkridge, MD, USA
When the character selected from CharSet is left parenthesis "(" it confuses the parser. Use %@SafeExp[@Instr[%I,1,%Charset]] - it works!
Another simplification - use the syntax below:
do c in /c %CharSet
@Echo %@SafeEnv[c] %@Index[%Charset,%c]

Advantages of DO /C vs. FOR:
1/ no need to determine character count in CharSet - automatic (you may use an explicit loop counter)
2/ character of interest is automatically extracted, need not be extracted more than once
3/ DO loops can be debugged via BDEBUGGER, FOR cannot
HTH, Steve
May 24, 2010
Northlake, Il
Thank you Steve, that will do it. (And I understood that it was confusing the parser, I just didn't (and still don't) know why. Not that it really matters.) As far as the "Do" you suggest goes, it's just one more instance in the plethora of capabilities of this product. Sadly for me, there's far more than my limited memory can handle.
Similar threads
Thread starter Title Forum Replies Date
T Fixed Function @timer[] does not work as required Support 6
D Parsing an array variable to an array does not work Support 5
J Take command does not start on Windows 10 Support 3
J ffind does not find files Support 4
Joe Caverly PAUSE does not erase countdown timer Support 0
D ParentDirectory does not update directory history Support 6
D Documentation Help "Startup" page does not describe global lists Support 0
Charles Dye Does HASH's /E option do anything? Support 1
fishman@panix.com First TCC instantiation after reboot does not work. Support 17
D Fixed @VERSION does not increment pre-fixed version numbers. Support 1
vefatica Why does @WSLPATH double the leading '/'? Support 7
D What does the file "..\Everything\Run history.csv" store? Support 5
Peter Murschall WAD rem does not work correctly Support 8
vefatica Does @SYMLINK work? Support 6
R Tree on FAT32 does not sort by name by default. Support 6
A Tcc does not recognize "bcdedit" Support 20
MickeyF Why does this batch file give me 'unknown command "else"' error? Support 17
M Ctrl-C when using command line history does nothing Support 2
vefatica JOBS /K ... how does it work? Support 5
Joe Caverly Why does TCCRT return VIEW as an internal command? Support 6
D Does TCC improve CMD's implementation of ECHO? Support 6
vefatica Find Files/Text dialog: does it work? Support 0
Alpengreis [v22.00.41] sync command flag "/X" does not work Support 22
Joe Caverly .PS1 script does not work with PSHELL Support 11
M MOVE does not behaves like intended (on failure) Support 1
R Fixed Sendmail parameter /USER= does not work Support 4
twaterloo does tcc have a task sceduler Support 4
Brian Woodward How to? Does FTP.CFG only support SSL over port 21? (Newbie) Support 6
M Activation Key does not correspond… Support 2
James Miller tcc shell window does not disappear Support 18
D Lua does not work on the commandline Support 5
D Fresh instance of TCMD does not use TCMD.INI Support 7
D Fixed @Lua does not behave as documented Support 8
D everything /o does not open the option dialog Support 4
M Why does HELP keep opening in the background? Support 0
vefatica Does TCC know I'm visiting the forums? Support 76
vefatica Why does my forum theme keep changing? Support 1
fishman@panix.com 19.02.37 Does Not Install For Me Support 2
I Windows 10 console does not allow alt-F4 alias to complete Support 1
fromano WAD ver /r does not detect Win 10B10166 Support 5
Alpengreis Fixed BATCOMP /O does not work Support 1
D Fixed Cut and paste in TC's file/folder view does not remove file Support 17
E View (internal command) does nothing now Support 3
D How does Cut work? Support 8
B How to? why does my BTM stop Support 2
I "IF" command in a variable does not expand redirection variable name Support 0
samintz How to? What does ~ do? Support 1
C Msg Popup window does not close Support 8
D WAD Alt-Left doesn't work, but Alt-Shift-Left does Support 1
Joe Caverly @SCRIPT does not like all comments Support 2

Similar threads