Community
    • Login

    Running Notepad++ from a bat file

    Scheduled Pinned Locked Moved General Discussion
    4 Posts 3 Posters 215 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.
    • Kelly AK
      Kelly A
      last edited by

      Is it possible to call Notepad++ from a bat file? I need to do a “find and replace” for multiple XML files and Notepad is the tool for it if I can automate it. That or add the macro I also created to a bat file that I can then put on a schedule.

      PeterJonesP Alan KilbornA 2 Replies Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Kelly A
        last edited by

        @Kelly-A ,

        You can run Notepad++ from a batch file (.bat) – but there is no command line option to run a find-and-replace or macro from the command line, so you cannot initiate that task from your command-line call.

        If you have the PythonScript plugin, you could send that plugin a -pluginMessage command-line argument. You would then have to have a script in the PythonScript plugin that runs ATSTARTUP, which attaches a callback to the NPPN_CMDLINEPLUGINMSG notification, or just process it at startup.

        In searching back through the forum, proessing that notification in PythonScript has been suggested before, but I cannot currently find any mention of that being implemented yet, so i don’t think there’s an example for PythonScript.

        Kelly AK 1 Reply Last reply Reply Quote 3
        • Kelly AK
          Kelly A @PeterJones
          last edited by

          @PeterJones Thanks so much for the quick response. I may just have the users run the macro since it doesn’t involve opening anything other than the app. It should be simple enough for a non-tech person and will do the job.

          Again, I appreciate the reply.

          1 Reply Last reply Reply Quote 0
          • PeterJonesP PeterJones referenced this topic on
          • Alan KilbornA
            Alan Kilborn @Kelly A
            last edited by

            I just want to add a note here, that if someone wants to use the method Peter has suggested to run a search-and-replace macro, that macro would not be “general purpose”.

            That is, you cannot, say, pass search strings or replacement strings in this way, because macros, when made and saved, have their search string, replace string, directory (if “in files”), and other options all “hard-coded”.

            I say this because this is the kind of thing people would want to do.

            The above doesn’t sound like a problem for @Kelly-A , who needs an operation that is by its nature NOT parameterized.

            You can, of course, write script code to do any search/replacement you’d like, but that requires greater programming skills, which not everyone has, or wants to invest the time into.

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