Bracket Matching in Batch files (.bat)
-
The bracket matching doesn’t work in batch files when an IF-ELSE is used. Does anyone know how to correct this? The first group is recognized (@echo.Won’t Happen) but the second one isn’t (@echo.Hello World). Thanks
@if 1.==2. (
@echo.Won’t happen
) else (
@echo.Hello World
) -
yes, this is a scintilla editor component issue and present at all scintilla based editors, including the latest Scite 4.1.5.
but you are not limited to use the integrated lexers only, as notepad++ has the user defined language feature.
it you e.g. download WinBatch and copy
userDefineLang_winbatch.xml
to your%AppData%\Notepad++\userDefineLangs\
folder, you can use it as a replacement for the scintilla batch lexer, and it matches all brackets of your example.have a look around searching for notepad++ udl or user defined language, maybe you find more that are of interest for you.
best regards.
-
@Meta-Chuh said:
notepad++ udl
Hmmm. The file you suggested as a replacement for the Batch language and is not similar to the NP++ Batch language styles at all, and only corrects the ELSE(…) bracket issue. While I can create a user defined UDL, to highlight keywords, I cannot recreate style to be equal to the otherwise usable default Batch UDL. The keyword nor delimiter highlighting does not work the same as the default Batch style.
-
in code of .bat do
if “%tjkdrrdiiff%”==“” (goto notselecteditem) else (goto selecteditem)
:notselecteditem
bin\filebrowse UNPACK_REPACK_V3.8_FINAL file_contexts.bin,file_contexts,boot.img, “boot.img|boot;file_contexts” > bin\fil76elocate.txt
set /p tjkdrrdiiff=< bin\fil76elocate.txt
if “%tjkdrrdiiff%”==“” (goto ejhcnnsjdj)
:selecteditem
del /S/Q bin\fil76elocate.txt