I found a strange behaviour in the syntax error handling.
I forced a syntax error with a simple %VAR:=WRONG SYNTAX%
Normally you see something like
But if the preceding line contains one of the internal-internal commands REM,IF, FOR (with a special parser), then the error message changes a little bit (One more line is appended)Output wrote:"=WRONG SYNTAX%
" kann syntaktisch an dieser Stelle nicht verarbeitet werden.
Code: Select all
set var=CONTENT
REM
%var:=WRONG SYNTAX%
But when I change "REM" to "REM." the error message changes againOutput wrote:"=WRONG SYNTAX%
" kann syntaktisch an dieser Stelle nicht verarbeitet werden.
Syntaxfehler.
Code: Select all
setlocal
set var=CONTENT
set "PATH=%PATH%;C:\UNEXPECTED"
REM.
%var:=WRONG SYNTAX%
This even works when I changed the command to something different like "echo.HELLO"
When the problematic code is just behind a called label the output changes againOutput wrote: "=WRONG SYNTAX%
" kann syntaktisch an dieser Stelle nicht verarbeitet werden.
"C:\UNEXPECTED\REM..*" kann syntaktisch an dieser Stelle nicht verarbeitet werden.
Code: Select all
@echo off
setlocal
set var=CONTENT
goto :label
:label You can see the whole line
%var:=WRONG SYNTAX%
But why I show these observationsOutput wrote:"=WRONG SYNTAX%
" kann syntaktisch an dieser Stelle nicht verarbeitet werden.
":label You can see the whole line
" kann syntaktisch an dieser Stelle nicht verarbeitet werden.
Because, I hope to find a way to execute some commands after a syntax error occours.
jeb