The output needs a special format:
<Filename> (<LineNumber>): Warning: <ErrorMessage>
Instead of Warning you could also use Error
Also the spaces are important!
You could create it like this one
echo %~f0 (!lineNo!^): Warning: Invalid target for production
And to give a hint for the error position you should add a more or less accurate line number.
if /i "!TargetPath:~-3!"=="DLL" (
set "targetValid=1"
) ELSE (
call :GetLineNumber lineNo +1 {3D967145-10B6-44A0-96EF-91B6C6E2DD0E}
echo %~f0 (!lineNo!^): Warning: Invalid target '!TargetPath:~-3!' for production
)
....
:GetLineNumber returnVar add uniqueGUID
:::
:::
setlocal EnableDelayedExpansion
set "GetLineNumber.lineNo=0"
set /a "GetLineNumber.Add=%~2"
set "GetLineNumber.unique=%~3"
for /F "delims=:" %%L in ('findstr /n "!GetLineNumber.unique!" "%~f0"') do (
set /a "GetLineNumber.lineNo=%%L"
)
(
endlocal
set /a "%~1=%GetLineNumber.lineNo%" + %GetLineNumber.Add%
)
exit /b
echo %~f0: Warning: Hello
and it was happy with just omitting the line number. Could you provide a link to documentation for this feature? – Beware