Menu

How to start NPP from BAT

2008-06-11
2012-11-13
  • Idris Samawi Hamid

    Hi,

    Usually I start Npp from a batch file, which loads some ConTeXt-related environment variables (needed for NppExec scripts and running ConTeXt utilities). However if I

    1. left-click on a document in a folder; or
    2. right-click on a document in a folder and choose "Edit with Notepad++"

    then the main executable is called of course.

    Is there any registry wizardry or something similar I can do to always call up Npp from my npp.bat file, even when invoking Npp from the Explorer shell?

    Best wishes
    Idris

     
    • DV

      DV - 2008-06-13

      NppExec 0.2.4 allows to execute user-specified script each time Notepad++ starts. You can call your bat-file from such startup script, I think.
      (ver. 0.2.4 will be available on next week).

       
      • Idris Samawi Hamid

        Hi DV,

        Thanks for the response. I'm not sure that NppExec will help in this case, because the script loads the environent variables before Npp. But maybe there is a way to load them afterwards? (I'm really not very knowledgeable about this sort of thing).

        I'll send you a copy of this email with the BAT file attached....

        Bestg wishes
        Idris

         
    • Bertie

      Bertie - 2008-06-14

      You could do one of two things:

      1) Download source code for nppcm.dll and modify it yourself (get it here: http://notepad-plus.sourceforge.net/commun/misc/nppCM.src.zip\)

      2) Edit the registry, create a key under HKEY_CLASSES_ROOT and sub-key "*" called "shell", and under there you create a new key called e.g. "Edit with Notepad++" (your choice, the text to be displayed on the context menu), and under there again you create a new key called "command". In the "(Default)" value within the command key, add your command line (or e.g. "C:\Program Files\Notepad++\Notepad++.exe" "%1" for the regular behaviour).

       
      • Idris Samawi Hamid

        Thank you very much for your reply, Bertie!

        Best wishes
        Idris