我试图将以下命令作为MSBuild脚本的一部分运行:
for /R . %f in (*.targets) do copy /Y "%f" "C:\Program Files (x86)\MSBuild\Microso ft\VisualStudio\TeamBuild"
这些命令在exec中以下列方式实现:
该命令可以从控制台正常工作,但是当尝试从MSBuild运行它时,我收到错误:
Task "Exec" Command: for /R . %f in (*.targets) do copy /Y "%f" "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\TeamBuild" f" "C:\Program was unexpected at this time. C:\Users\rd-build\AppData\Local\Temp\OH Test2\Continuous.BuildTargets\BuildType\TFSBuild.proj(98,5): error MSB3073: The command "for /R . %f in (*.targets) do copy /Y "%f" "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\TeamBuild"" exited with code 255. Done executing task "Exec" -- FAILED.
有什么建议?
我刚刚在你上一个问题中解释过.在这种情况下,您需要在变量前添加额外的%.在FOR命令的帮助下解释如下
要在批处理程序中使用FOR命令,请指定%% variable而不是%variable.