Running Notepad++ from a bat file
-
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.
-
@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.
-
@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.
-
P PeterJones referenced this topic on
-
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.