windows - Windows Cmd 中的 Cygwin Bash 未运行可执行文件

标签 windows bash cygwin exe

我有一个在 cygwin 中编译的程序,我试图从批处理文件中调用它:

D:\cygwin\bin\bash --login -i C:/ILS/trunk/NAVAID/test.exe

但我收到错误:

bash: C:/ILS/trunk/NAVAID/test.exe: cannot execute binary file

当我在 cygwin 中文件 test.exe 时,我得到:

test.exe: PE32 executable (console) Intel 80386, for MS Windows

有什么想法为什么它无法运行吗?我在网上发现的大多数错误都来自尝试运行 Linux 应用程序的人,但这是直接在 cygwin(在同一台机器上)中编译(通过 g++)的东西。

如果重要的话,在 Windows 8 上。

最佳答案

您可以尝试-c <command >

D:\cygwin\bin\bash --login -c C:/ILS/trunk/NAVAID/test.exe

这会在 bash shell 下运行 test.exe。 Details on -c option

There are several single-character options that may be supplied at invocation which are not available with the set builtin.

-c string Read and execute commands from string after processing the options, then exit. Any remaining arguments are assigned to the positional parameters, starting with $0.

-i开始 interactive shell ,在这种情况下这不是您想要的。

最后为了完成 - bash 有 --rcfile <file path>提供启动文件的选项。

关于windows - Windows Cmd 中的 Cygwin Bash 未运行可执行文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15721597/

相关文章:

c++ - Directory_iterator 跳过无法访问的文件夹 Windows

windows - 有多少百分比的 Windows 机器支持 OpenGL

适合菜鸟的 Python 数据包嗅探器和套接字

linux - 在 BASH 中以特定格式列出多个文件

c++ - 为什么我的 C++ 代码在 Linux 上运行而不在 Windows 上运行,RAM 内存有问题吗?

Bash for 循环在一次迭代后停止而没有错误

bash - 在 bash 脚本中期待

windows-10 - cygwin上的sdkman无法安装

git - 交互式 git rebase 失败,返回 "git-rebase-todo: No such file or directory"

python - shell脚本检查python版本