Parsing problem? (IFF, "", &)

May 30, 2008
TCC 10,00,67 Windows XP [Version 5,1,2600]

I encountered a strange phenomenon when debugging a batchfile using IFF.

Here's a simplified illustration.

@echo off

alias mystart=`iff "%@unquote[%1]" == "." .AND. %# == 1 then & echo start dot & else & (echo start %$) & endiff`

echo Test 1 - direct arg

mystart .
mystart "."
mystart "q&a.txt"

echo Test 2 - arg via variable

mystart .
mystart "."
set arg="q&a.txt"
mystart %arg%
The output should be the same in both cases, but that is not the case.

14:39 (2009-06-22) C:\User\fl>test

Test 1 - direct arg

start dot
start dot
C:\User\fl\test.btm [11]  Usage : IFF [NOT] condition [.AND. | .OR. | .XOR. [NOT] condition ...] THEN & commands
TCC: C:\User\fl\test.btm [11]  Unknown command "a.txt]"
start dot
TCC: C:\User\fl\test.btm [11]  Unknown command "else"
start "q&a.txt"
TCC: C:\User\fl\test.btm [11]  Unknown command "endiff"

Test 2 - arg via variable

start dot
start dot
start "q&a.txt"
The problem seems to be using IFF to compare strings with embedded '&' characters. But only when giving the problem string directly to the alias using IFF, if the argument is provided via an environmen variable it works as expected.
Similar threads
Thread starter Title Forum Replies Date
D Parsing an array variable to an array does not work Support 5
vefatica IF, @WMI, parsing? Support 7
M Command line parsing differences between cmd.exe and TCC Support 6
nickles Command name parsing of GNU compilers Support 13
J Python: TCC command line parsing removes '=' equal sign characters Support 4
H command line parsing question Support 5
cgunhouse One of the Focuses of V17 Beta Testing Should Be Command Line Parsing Support 1
M How to? Parsing lines containing double quotes... Support 3
Stefano Piccardi parsing issue in command GLOBAL Support 3
C CMD if parsing Support 2
M A probably stupid question about .btm file argument parsing... Support 6
S New "home" variable parsing issue Support 1
samintz Help with some parsing Support 6
vefatica Parsing error! Support 9
Dick Johnson Weird Color Problem Support 8 Problem with 27.15 Support 2
M Problem with VSDevCmd.bat in VS 16.7.3 Support 0
R Problem with @INT[ value] in V26 Support 9
M Selecting test "off by one" problem in Take command Support 4
Alpengreis UTF-8 problem in TCC related to Python Support 7
K_Meinhard Small problem in german IDE 26 Support 3
B Problem with color in nested shells Support 1
Joe Caverly Problem creating and switching to a DESKTOP Support 9
vefatica Another popup problem Support 10
Alpengreis ffind dialog (/W) problem Support 4
Alpengreis [TCMD v25.00.24] Small space problem with the DE translation in Prefs-GUI Support 1
Alpengreis [TCMD v25.00.24] Problem with copy and paste and the # char via mouse in TCC Support 6
A Problem with functions @int @decimal and identifying Powershell as a shell. Support 12
B IF command problem in tcexit.btm Support 9 Problem at Startup of TCC Support 3
P Problem with SFTP copies Support 7
P Problem with FTP copies Support 10
Jay Sage Problem with Context Menu Copy+Paste+Run Key Assignment Support 7
R Problem with %_do_loop in nested do loops Support 2 New Problem with later Windows 10 Support 10
Peter Murschall A little problem with LEAVE and COMMENT Support 5
M Handling of %~I problem Support 4
WinLanEm FOR problem Support 18
K Problem With SCRPUT /u Support 3
vefatica What's TCMD's problem with ^e[0m? Support 13
Peter Murschall IDE: RTL with non-English resources-problem is back in Build 28 Support 4
rps Regex problem: \xnn not recognized as a hex character Support 0
rps PRIORITY LOW problem Support 1
old coot Regex problem: \xnn not recognized as a hex character Support 12
vefatica Another problem with build 22. Support 3
Alpengreis [23.x] Download-Problem Support 2
S Problem with " Support 3
C Problem navigating forums Support 11
x13 Problem listing repository files using DIR http(s)://... Support 8
Joe Caverly Problem with TEE in v22 Support 2

Similar threads