Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running a bash shell script on Windows from within in Notepad++ using NppExec (and Cygwin)

I'm trying to reconstruct how to execute a bash shell .sh file on my Windows machine from within Notepad++ using NPPExec. (I've done this successfully before, but my HDD crashed and I don't recall how I did it previously.)

When it was working before, I would run the NPPExec script that called a .sh file, and it showed me the console output of the .sh file processing in Notepad++ as if it were processing in cygwin.

This is the example .sh file that I'm trying to get to work:

message="Testing"
echo $message

This file is located in the root of C:.

Failed Attempts:

None of the following three methods work:

  • Execute: C:\nppexec.sh

Response:

CreateProcess() failed with error code 193:
%1 is not a valid Win32 application.
  • Execute: npp_exec C:\nppexec.sh

Response:

message="Testing"
CreateProcess() failed with error code 2:
The system cannot find the file specified.    
$message
  • Adding #! /bin/bash to the .sh file as the first line just causes an additional error when npp_exec is run:

    NPP_EXEC: C:\nppexec.sh
    #! /bin/bash
    CreateProcess() failed with error code 2:
    The system cannot find the file specified.
    
like image 666
Validatorian Avatar asked Nov 23 '25 13:11

Validatorian


1 Answers

The solution was to call bash directly:

C:\cygwin\bin\bash --login -c "command.sh"
like image 91
Validatorian Avatar answered Nov 25 '25 03:11

Validatorian



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!