- Dec
- 265
- 4
I created the following:
@echo off
setlocal
On error, goto ErrorHndl_1
Echo unknown_cmd is set to
Echo Pre-IFF
IF "%1" == "/h" or "%1" == "/H" or "%1" == "-h" or "%1" == "//?" (
on error goto ErrorHndl_2
echo Pre-Text
TEXT
TEXT command output
ENDTEXT
echo Post-Text
)
Echo Post-IFF
quit
Echo: Why didn't I quit?
:ErrorHndl_1
Echo ErrorHndl_1
quit
Echo: Why didn't I quit?
:ErrorHndl_2
Echo ErrorHndl_2
quit
Echo: Why didn't I quit?
named it test.btm and ran the following:
test /h
and got the following output:
unknown_cmd is set to echo Error in command "%$"
Pre-IFF
Error in command "or "/h" == "/H" or "/h" == "-h" or "/h" == "//?" ( on error goto ErrorHndl_2"
Pre-Text
Echo Post-IFF
quit
echo Why didn't I quit?
:ErrorHndl_1
Echo ErrorHndl_1
quit
echo Why didn't I quit?
:ErrorHndl_2
Echo ErrorHndl_2
quit
echo Why didn't I quit?
ErrorHndl_1
Seems like everything was considered part of the TEXT ... ENDTEXT body, the ENDTEXT was ignored.
So I tried another test and the code is as follows:
@echo off
setlocal
on error goto ErrorHndl_1
Echo unknown_cmd is set to
Echo Pre-IFF
IFF "%1" == "/h" or "%1" == "/H" or "%1" == "-h" or "%1" == "//?" THEN
on error goto ErrorHndl_2
echo Pre-Text
TEXT
TEXT command output
ENDTEXT
echo Post-Text
ENDIFF
Echo Post-IFF
quit
:ErrorHndl_1
Echo ErrorHndl_1
quit
:ErrorHndl_2
Echo ErrorHndl_2
quit
and got the following output:
unknown_cmd is set to echo Error in command "%$"
Pre-IFF
Error in command "or "/h" == "/H" or "/h" == "-h" or "/h" == "//?" THEN"
Pre-Text
TEXT command output
Post-Text
Error in command "ENDIFF"
Post-IFF
It quit but it seems that the "ENDIFF" command generated an unknown error, I think that this is still related to the TEXT ... ENDTEXT command.
Any thoughts on what I am doing wrong or is this a bug? I am using TCC 36.01.55.
Thanks
@echo off
setlocal
On error, goto ErrorHndl_1
Echo unknown_cmd is set to
echo Error in command "%$"Echo Pre-IFF
IF "%1" == "/h" or "%1" == "/H" or "%1" == "-h" or "%1" == "//?" (
on error goto ErrorHndl_2
echo Pre-Text
TEXT
TEXT command output
ENDTEXT
echo Post-Text
)
Echo Post-IFF
quit
Echo: Why didn't I quit?
:ErrorHndl_1
Echo ErrorHndl_1
quit
Echo: Why didn't I quit?
:ErrorHndl_2
Echo ErrorHndl_2
quit
Echo: Why didn't I quit?
named it test.btm and ran the following:
test /h
and got the following output:
unknown_cmd is set to echo Error in command "%$"
Pre-IFF
Error in command "or "/h" == "/H" or "/h" == "-h" or "/h" == "//?" ( on error goto ErrorHndl_2"
Pre-Text
Echo Post-IFF
quit
echo Why didn't I quit?
:ErrorHndl_1
Echo ErrorHndl_1
quit
echo Why didn't I quit?
:ErrorHndl_2
Echo ErrorHndl_2
quit
echo Why didn't I quit?
ErrorHndl_1
Seems like everything was considered part of the TEXT ... ENDTEXT body, the ENDTEXT was ignored.
So I tried another test and the code is as follows:
@echo off
setlocal
on error goto ErrorHndl_1
Echo unknown_cmd is set to
echo Error in command "%$"Echo Pre-IFF
IFF "%1" == "/h" or "%1" == "/H" or "%1" == "-h" or "%1" == "//?" THEN
on error goto ErrorHndl_2
echo Pre-Text
TEXT
TEXT command output
ENDTEXT
echo Post-Text
ENDIFF
Echo Post-IFF
quit
:ErrorHndl_1
Echo ErrorHndl_1
quit
:ErrorHndl_2
Echo ErrorHndl_2
quit
and got the following output:
unknown_cmd is set to echo Error in command "%$"
Pre-IFF
Error in command "or "/h" == "/H" or "/h" == "-h" or "/h" == "//?" THEN"
Pre-Text
TEXT command output
Post-Text
Error in command "ENDIFF"
Post-IFF
It quit but it seems that the "ENDIFF" command generated an unknown error, I think that this is still related to the TEXT ... ENDTEXT command.
Any thoughts on what I am doing wrong or is this a bug? I am using TCC 36.01.55.
Thanks