为了避免将长命令重新输入到MSYS进行配置,我通常使用批处理文件来存储该命令,如下所示:
./configure \
--arch=x86_64 \
--target-os=win64 \
--toolchain=msvc \
--enable-cross-compile \
--enable-gpl \
--disable-debug \
--enable-shared \
这种方式适用于MSYS。但是,当我在MSYS2中运行批处理文件时,它发现了许多错误消息,例如:
'.' is not recognized as an internal or external command,
operable program or batch file.
'--arch' is not recognized as an internal or external command,
operable program or batch file.
etc...
谁能解释我的原因是什么?
正如您所展示的,您的“ batch”文件看起来更像是Bourne shell脚本,因此绝对不应该将其视为.bat
文件。现在,如果您将[.bat
文件,则MSYS将无法直接运行它;它需要一个shebang行以使其可以作为Shell脚本执行。从显示的错误消息看来,通过将执行交给Windows命令解释程序,MSYS2可能试图以某种聪明的方式(而MSYS却不这样做)(这些错误消息是cmd.exe
错误消息)。由于脚本采用的是Bourne shell语法,因此您希望MSYS2直接在bash
中运行它。
是
bash
; AFAIK,MSYS2还提供bash
作为其主外壳。命令行:VSC.bat -c / Config / BswM
bat文件“看到的内容:VSC.bat -c C:/ mingw64 / msys / Config / BswM
是否可以关闭此转换?