Community
    • Login

    Bracket Matching in Batch files (.bat)

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 3 Posters 1.1k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Brian ZeltB Offline
      Brian Zelt
      last edited by

      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
      )

      Meta ChuhM 1 Reply Last reply Reply Quote 0
      • Meta ChuhM Offline
        Meta Chuh moderator @Brian Zelt
        last edited by Meta Chuh

        @Brian-Zelt

        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.

        1 Reply Last reply Reply Quote 2
        • Brian ZeltB Offline
          Brian Zelt
          last edited by

          @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.

          1 Reply Last reply Reply Quote 0
          • rinku singhR Offline
            rinku singh
            last edited by

            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

            1 Reply Last reply Reply Quote 0

            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
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors