假设Delphi项目中的bin\
目录包含文件Cert.pem
和Key.pem
,下面的Delphi后构建事件仅在C:\Binaries\Cert.pem
不存在时复制这两个文件:
if not exist $(OUTPUTDIR)Cert.pem (copy bin\Cert.pem $(OUTPUTDIR))
if not exist $(OUTPUTDIR)Key.pem (copy bin\Key.pem $(OUTPUTDIR))
只要 C:\Binaries\Cert.pem
存在,Key.pem
文件就不会被复制。
我该如何在 post-build 事件中解决这个问题?
编辑:与我的 2014 年的帖子 不同,这确实可以使用括号解决。请参见下面的答案。
IF EXIST MyFile.txt (ECHO Some(more)Potatoes)
,你只需要添加一个小的脱字符号 ...IF EXIST MyFile.txt (ECHO Some(more^)Potatoes)
(好的,就是脱字符号...) - Magoo