您的命令包含shell字符,并传递给
cmd.exe
:
>cd ../Public && ../test
'..' is not recognized as an internal or external command,
operable program or batch file.
>cd ../Public && ..\test
'..\test' is not recognized as an internal or external command,
operable program or batch file.
即
命令提示符
解释
../test
作为命令
..
有选择权
/test
.
我想有一种解决方案可以将宏应用于具有路径的命令名,例如(
笔记
:未测试,刚从我的头上键入):
if (...I'm running under Windows...)
convert_path = $(subst /,\\,$(1))
else
convert_path = $(1)
endif
all:
cd ../ProjectDir && $(call convert_path,../AutoExc) InputFile.h
或者,如果可能,使用评论中的建议
SHELL := /bin/sh
,或者在您的Windows环境中指向与Unix兼容的shell的正确路径。”Git for Windows“是基于Mingw的,所以您应该
bash
可用。