Community
    • Login

    Adding New Commands for PowerShell

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    5 Posts 3 Posters 719 Views
    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.
    • unDrac86U
      unDrac86
      last edited by

      I’m using Notepad++ to code PS1 scripts, but they seem to be missing all the Windows 2016 and Hyper-V Server Commands.

      I’m tying to add the server commands, but they Styler Configure doesn’t allow all the commands (there are 1650 of them I pulled from the Server).
      I attempted to edit langs.xml, but it doesn’t seem to take

      [langs.xml] << Small Example
      ~~
      <Keywords name=“instre3”>Get-VM New-VM</Keywords
      ~~

      I did use the parsing format seen in PHP Keywods since that section was 10 miles long. Does anyone have any information on how to get all these commands loaded?

      Thanks in Advance!!

      Michael VincentM 1 Reply Last reply Reply Quote 0
      • Michael VincentM
        Michael Vincent @unDrac86
        last edited by

        @unDrac86 said in Adding New Commands for PowerShell:

        I’m using Notepad++ to code PS1 scripts, but they seem to be missing all the Windows 2016 and Hyper-V Server Commands.
        I’m tying to add the server commands, but they Styler Configure doesn’t allow all the commands (there are 1650 of them I pulled from the Server).
        I attempted to edit langs.xml, but it doesn’t seem to take
        [langs.xml] << Small Example
        ~~
        <Keywords name=“instre3”>Get-VM New-VM</Keywords
        ~~
        I did use the parsing format seen in PHP Keywods since that section was 10 miles long. Does anyone have any information on how to get all these commands loaded?

        Maybe try using Settings => Style Configurator and adding them there?

        1d23a754-5236-4966-af20-c2d8cd0d7f94-image.png

        Cheers.

        1 Reply Last reply Reply Quote 2
        • unDrac86U
          unDrac86
          last edited by

          Yes, I did that, but it has a char cap. All 1650 commands don’t fit.
          I’m looking for a way to edit or add to the lang.xml (or user saved configuration files to dump all of the commands in).

          Michael VincentM PeterJonesP 2 Replies Last reply Reply Quote 0
          • Michael VincentM
            Michael Vincent @unDrac86
            last edited by

            @unDrac86 said in Adding New Commands for PowerShell:

            I’m looking for a way to edit or add to the lang.xml (or user saved configuration files to dump all of the commands in).

            They way I suggest will add the commands to sytlers.xml (if using the default style) or to the appropriate themes\FILENAME.xml file. You can try adding them to those files depending on which one you’re using, example from my custom style below:

                    <LexerType name="powershell" desc="PowerShell" ext="">
                        <WordsStyle name="DEFAULT" styleID="0" fgColor="E0E2E4" bgColor="293134" fontName="" fontStyle="0" fontSize="" />
                        <WordsStyle name="COMMENT" styleID="1" fgColor="66747B" bgColor="293134" fontName="" fontStyle="0" fontSize="" />
                        <WordsStyle name="STRING" styleID="2" fgColor="EC7600" bgColor="293134" fontName="" fontStyle="0" fontSize="" />
                        <WordsStyle name="CHARACTER" styleID="3" fgColor="EC7600" bgColor="293134" fontName="" fontStyle="0" fontSize="" />
                        <WordsStyle name="NUMBER" styleID="4" fgColor="FFCD22" bgColor="293134" fontName="" fontStyle="0" fontSize="" />
                        <WordsStyle name="VARIABLE" styleID="5" fgColor="678CB1" bgColor="293134" fontName="" fontStyle="1" fontSize="" />
                        <WordsStyle name="OPERATOR" styleID="6" fgColor="E8E2B7" bgColor="293134" fontName="" fontStyle="1" fontSize="" />
                        <WordsStyle name="INSTRUCTION WORD" styleID="8" fgColor="93C763" bgColor="293134" fontName="" fontStyle="1" fontSize="" keywordClass="instre1">begin catch end process try</WordsStyle>
                        <WordsStyle name="CMDLET" styleID="9" fgColor="93C763" bgColor="293134" fontName="" fontStyle="0" fontSize="" keywordClass="instre2">get-psreadlinekeyhandler get-psreadlineoption set-psreadlinekeyhandler set-psreadlineoption</WordsStyle>
                        <WordsStyle name="ALIAS" styleID="10" fgColor="E0E2E4" bgColor="293134" fontName="" fontStyle="0" fontSize="" keywordClass="type1" />
                        <WordsStyle name="COMMENT STREAM" styleID="13" fgColor="66747B" bgColor="293134" fontName="" fontStyle="0" fontSize="" />
                        <WordsStyle name="HERE STRING" styleID="14" fgColor="808080" bgColor="293134" fontName="" fontStyle="0" fontSize="" />
                        <WordsStyle name="HERE CHARACTER" styleID="15" fgColor="808080" bgColor="293134" fontName="" fontStyle="0" fontSize="" />
                        <WordsStyle name="COMMENT DOC KEYWORD" styleID="16" fgColor="66747B" bgColor="293134" fontName="" fontStyle="1" fontSize="" keywordClass="type4" />
                    </LexerType>
            

            Cheers.

            1 Reply Last reply Reply Quote 2
            • PeterJonesP
              PeterJones @unDrac86
              last edited by PeterJones

              @unDrac86 said in Adding New Commands for PowerShell:

              I’m looking for a way to edit or add to the lang.xml (or user saved configuration files to dump all of the commands in).

              For some languages, you can just edit the langs.xml. Just follow the config-file editing advice. For the CMDLET style, it’s under the instre2 group of keywords.

              51b389e1-881c-48f0-8816-953e696dd45e-image.png

              … but I’ve never tried adding 1650 words (so probably 8k bytes) to one of the existing keywords groups; so I don’t know whether the langs.xml will process an entry that big. But you can try it.

              1 Reply Last reply Reply Quote 1
              • First post
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors