NPPExec script failing with CreateProcess() failed with error code 2:

4.2k Views Asked by At

I have the following command in NPPExec:

NPP_SAVE
npp_exec "C:\bin\foo.sh"

Where foo.sh contains the following:

#! /bin/bash
echo "This is a test script"

This is the output from the NPPExec console:

NPP_SAVE: C:\bin\foo.sh
NPP_EXEC: "C:\bin\foo.sh"
#! /bin/bash
CreateProcess() failed with error code 2:
The system cannot find the file specified.

"This is a test script"
================ READY ================

I want NPP_EXEC to just run the script, and leave it alone after that. I had this working before, but my HD crashed, now I can't seem to get it working again.

1

There are 1 best solutions below

0
On

Remove the sh-bang line (#!/bin/bash) from your code.

That line tells the process to look for an executable file named C:\bin\bash on your computer, then use that file to run the ensuing script. Apparently, the process can't find said file. But it shouldn't need to find it. Windows* can run your .sh file as an executable.

*(If you're using Notepad++, you're on Windows, right?)

Alternatively, put an executable file named "bash" in your folder "/bin", and let that "bash" file have the capability of running your shell script.