【问题标题】:NPPExec script failing with CreateProcess() failed with error code 2:NPPExec 脚本因 CreateProcess() 失败而失败,错误代码为 2:
【发布时间】:2012-01-27 19:37:58
【问题描述】:

我在 NPPExec 中有以下命令:

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

其中 foo.sh 包含以下内容:

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

这是 NPPExec 控制台的输出:

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 ================

我希望 NPP_EXEC 只运行脚本,然后不理会它。我以前有这个工作,但我的 HD 崩溃了,现在我似乎无法让它再次工作。

【问题讨论】:

    标签: shell notepad++ nppexec


    【解决方案1】:

    从您的代码中删除 sh-bang 行 (#!/bin/bash)。

    该行告诉进程在您的计算机上查找名为 C:\bin\bash 的可执行文件,然后使用该文件运行随后的脚本。显然,该过程找不到所述文件。但它不应该需要找到它。 Windows* 可以将您的 .sh 文件作为可执行文件运行。

    *(如果您使用的是 Notepad++,那么您使用的是 Windows,对吗?)

    或者,将一个名为“bash”的可执行文件放入您的文件夹“/bin”中,并让该“bash”文件具有运行您的 shell 脚本的能力。

    【讨论】:

      猜你喜欢
      • 2014-02-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-06
      • 1970-01-01
      • 2015-07-29
      相关资源
      最近更新 更多