NppExec - Command unkown to NppExec, Environment variable is set

1.1k Views Asked by At

I am trying to execute a small perl6 script via Notepad++ and NppExec. My system is Windows 10 and i set the PATH variable properly to C:\rakudo\bin where the perl6 executable is. When i am executing the script via normal console with:

perl6 "path/to/script.pl6" 

it gets executed without a problem.

However, when i execute the exact same command in NppExec as following:

CD $(CURRENT_DIRECTORY)
perl6 "$(FILE_NAME)"

i get the error: CreateProcess() failed with error code 2: The system cannot find the file specified.

Obviously, the command "perl6" is unkown to NppExec... My question: How can i make the PATH variable known to NppExec or is this problem related to something else?

3

There are 3 best solutions below

1
On BEST ANSWER

You can show the PATH that NppExec knows with the following NppExec command:

env_set PATH

So you can check if the path to perl is there or not. A rather simple way to run perl would be using the full path to perl6 in you original script. Btw, you can use $(FULL_CURRENT_PATH).

0
On

I solved the problem by entering the full path to the perl executable. So my NppExec command now looks like:

CD "$(CURRENT_PATH)"
"C:\rakudo\bin\perl6.bat" "$(FILE_NAME)"

and the script gets executed properly.

It is also possible to use the env variable. One has to add the file ending:

CD "$(CURRENT_PATH)"
perl6.bat "$(FILE_NAME)"

works as well.

0
On

Seems like NppExec is smart enough to search for applications in environment PATH. However it does not add .bat extension automatically. In my case adding .bat solved the problem. So this works:

gradle.bat