Welcome!

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

SignUp Now!

break script on syntex error

Apr
43
0
in CMD, syntex error of internal command will break the script.
for example:
Code:
@echo off
for /q %%i in (.) do echo %%i
echo done
/q is invalid FOR switch in both CMD and TCC.
CMD will print "/q was unexpected at this time." and back to prompt.

but TCC will execute "echo done".
 
| in CMD, syntex error of internal command will break the script.
| for example:
|
| Code:
| ---------
| @echo off
| for /q %%i in (.) do echo %%i
| echo done
| ---------
| /q is invalid FOR switch in both CMD and TCC.
| CMD will print "/q was unexpected at this time." and back to prompt.
|
| but TCC will execute "echo done".

Yes, TCC is designed for easier debugging, and it will try to execute the
whole program even in the presense of errors. If you want to quit your batch
program on the first error, insert the command
on errormsg cancel
to display the error message and return to interactive operation.
--
HTH, Steve
 
> in CMD, syntex error of internal command will break the script.
> for example:
>
> Code:
> ---------
> @echo off
> for /q %%i in (.) do echo %%i
> echo done
> ---------
> /q is invalid FOR switch in both CMD and TCC.
> CMD will print "/q was unexpected at this time." and back to prompt.
>
> but TCC will execute "echo done".

That would seem to be a CMD.EXE bug/undocumented feature (and it does not
behave this way in all versions of CMD.EXE).

I don't see any benefit in duplicating this behavior in TCC. (Particularly
since it'll break existing batch files that are using ON ERROR.)

Rex Conn
JP Software
 
That would seem to be a CMD.EXE bug/undocumented feature (and it does not
behave this way in all versions of CMD.EXE).

I don't see any benefit in duplicating this behavior in TCC. (Particularly
since it'll break existing batch files that are using ON ERROR.)

Rex Conn
JP Software
but from my testing, this feature exists in NT 3.51/4.0/2000/XP.
I don't have windows newer than XP so I can't test.
 
> ---Quote (Originally by rconn)---
> That would seem to be a CMD.EXE bug/undocumented feature (and it does
> not
> behave this way in all versions of CMD.EXE).
>
> I don't see any benefit in duplicating this behavior in TCC.
> (Particularly
> since it'll break existing batch files that are using ON ERROR.)
>
> Rex Conn
> JP Software
> ---End Quote---
> but from my testing, this feature exists in NT 3.51/4.0/2000/XP.
> I don't have windows newer than XP so I can't test.

I wouldn't characterize it as a "feature".

And if TCC were to duplicate this behavior, it would render the batch
debugger useless (which probably wouldn't make most users especially
happy!).

Rex Conn
JP Software
 
as TCC/LE doesn't have debugger, and ON ERRORMSG can't handle for just specified command(CMD breaks on syntex error with FOR and IF only). I will still think it is nice to have option/enhance ON command to enable this feature.
 
as TCC/LE doesn't have debugger, and ON ERRORMSG can't handle for just specified command(CMD breaks on syntex error with FOR and IF only).

But not e.g. SET or DIR? That sounds like a bug to me!
 

Similar threads

Back
Top