How to execute Perl scripts in Notepad++

notepad++_perl_executeA few days ago I already described how to set up the Eclipse development environment for usage with Perl scripts. If you don’t want to use a sledgehammer to crack a nut,  you can also use the Notepad++ editor to relatively comfortably write Perl scripts.

Besides syntax highlighting and intellisense aka auto completion, Notepad++ also offers the possibility to execute Perl scripts directly from the editors interface. However, therefore a one-time setup is necessary, which I want you to briefly explain below.

Step 1 – create test scripts:

perl-skripte_in_npp_ausführen_1  perl-skripte_in_npp_ausführen_2

To be able to check if you have set up everything correctly later, you should definitely first create a small Perl script and save it. Important: Only stored scripts can be executed afterwards. So always save your script before clicking the “Run” button.

Step 2 – preparing the “Run” command:

perl-skripte_in_npp_ausführen_3  perl-skripte_in_npp_ausführen_4

In the Run dialog you must now specify the path to the Perl.exe on your computer. (The button with the three small dots opens a selection dialog.) Normally the Perl installation is placed directly on C:\ and the Perl.exe is located in a folder called “bin”.

Step 3 – set the “Run” parameter:

perl-skripte_in_npp_ausführen_5

Now you have to extend the command by the following parameter:

"$(FULL_CURRENT_PATH)"

Just look at the screenshot above, if you’re not sure how to set the parameter. Without these additional parameters indeed the Perl console would get opened, but our script won’t run.

Step 4 – create a hotkey:

perl-skripte_in_npp_ausführen_6

By clicking on the “Save” button you can create a shortcut aka hotkey to run your script.

Step 5 – test your result:

perl-skripte_in_npp_ausführen_7

Now everything should work. If you press your hotkey (combination) your script should be executed directly in the console now. As always, If you still have questions, write me a comment.

5 Comments

  1. Ghanshyamsays:

    Did u try anything different ?

    I have tried reopening notepad++ , it shows the same behaviour :(.

    Thanks

  2. Ghanshyamsays:

    Thanks a lot for the info , i have followed the steps , its executing good , but the command console screen is seen only for a short duration , very tough to verify the output.

    Please provide the solution to it.

    Thanks again

  3. lukesays:

    It executes to the console but it immediately closes the console window, making it problematic to verify output

Leave a comment

Please be polite. We appreciate that. Your email address will not be published and required fields are marked