在使用NMAKE、PowerShell和UNC路径清理当前构建时,我遇到了一些问题。在nmakefile中,我的目标是这样的:
clean: del obj\* /Q这应该删除所有文件从"obj“目录时,键入"nmake干净”。但是,它不起作用。我得到以下错误:
CMD.exe was started with the specified path
UNC paths are not supported
Using the Windows directory instead
System cannot find the specified file
NMAKE : fatal error U1077: 'del' : return code '0x1'说真的吗?它又回到Windows目录了吗?谢天谢地我没有
del *在干净的目标上。在最初的震惊(以及我没有使用上面的命令)之后,我试图找到另一种方法从nmakefile中清除我的"obj“目录。我尝试使用PowerShell命令而不是"del",即如下所示:
clean: Remove-Item obj/* -Recurse -Force然而,这仍然不起作用。NMAKE仍然试图启动CMD.exe,然后从那里运行“Remove”,这当然是行不通的。而且它还在做"fallback-to-Windows-directory-in-case-of-UNC-path“的恐怖!
有人能告诉我,我应该如何实现一个使用PowerShell和UNC路径的nmake干净目标吗?
还有,有什么办法可以让这种掉落到Windows目录下的恐惧消失吗?
谢谢!
发布于 2015-02-14 23:13:28
nmake似乎不支持PowerShell,因此需要使用参数运行PowerShell.exe,如下所示:
clean: powershell.exe -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command "Remove-Item obj/* -Recurse -Force"万一出了什么差错,先尝试一些无害的东西:
clean: powershell.exe -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command "Get-ChildItem /* -Recurse -Force"https://stackoverflow.com/questions/22270512
复制相似问题