我有一个在 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/