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.xmlto 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
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login