2012-06-27 60 views
3

我试图重建如何在使用NPPExec的Notepad ++内在我的Windows机器上执行bash shell .sh文件。 (我之前成功完成了这项工作,但是我的硬盘崩溃了,我不记得以前是怎么做的。)使用NppExec(和Cygwin)在Notepad ++中从Windows内部运行bash shell脚本

当它工作之前,我会运行NPPExec脚本,调用.sh文件,向我展示了在Notepad ++中处理.sh文件的控制台输出,就好像它是在cygwin中处理的一样。

这是我想要去工作的例子sh文件:

message="Testing" 
echo $message 

该文件位于C盘根:。

失败尝试:

以下三种方法都不奏效:

  • 执行:C:\nppexec.sh

响应:

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

响应:

message="Testing" 
CreateProcess() failed with error code 2: 
The system cannot find the file specified.  
$message 
  • 添加#! /bin/bash到sh文件作为第一线只是导致当npp_exec运行的附加误差:

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

回答

3

溶胶使用方法是直接调用bash:

C:\cygwin\bin\bash --login -c "command.sh" 
3

我试图在Windows上执行批处理文件时出现同样的错误。

我在记事本的控制台在第一个命令CMD执行++解决了这个问题,然后E:\ test.bat的

我也有安装在我的窗口PC上mksnt。

通过开始首先在记事本的控制台在bash ++,测试外壳做工以及现在

bash 
C:\nppexec.sh 
0

使用此运行命令

C:\cygwin64\bin\bash.exe -l -c "cd \"$0\" ; echo [email protected]; \"./$1\"; exec bash;" "$(CURRENT_DIRECTORY)" "$(FILE_NAME)"

您可以保存该命令从以后使用运行对话框。

0

随着一次击键我想执行记事本中使用Cygwin的活动标签的shell脚本。

几个小时在网上寻找和试验后,我终于想出了

  1. 安装NppExec插件
  2. 命中F6
  3. 粘贴以下代码:

    //save the file NPP_SAVE //redirect console output to $(OUTPUT) & silent mode npe_console v+ -- //convert winpath to cygpath D:\cygwin64\bin\bash -lc "cygpath \"$(FULL_CURRENT_PATH)\" //execute the file D:\cygwin64\bin\bash -lc "$(OUTPUT)"

希望sav é某些时间给某些人

相关问题