xcopy的一次误用及解决办法

作者:朱金灿

来源:http://blog.csdn.net/clever101

 

         一直迷信xcopy的强大功能,在复制文件的地方都用xcopy。今天在VS2008上设置一个生成后事件使用了xcopy命令:

xcopy /Y $(SDK_DLL)\$(ConfigurationName)\$(ProjectName)D.dll  $(SDK_BIN)\$(ConfigurationName)

        结果在执行这一命令时出错,提示:

1>正在执行生成后事件...

1>Does E:\2012\src\outdir\Debug specify a file name

1>or directory name on the target

1>(F = file, D = directory)? 

1>Does E:\2012\src\outdir\Debug specify a file name

1>or directory name on the target

1>(F = file, D = directory)? Project : error PRJ0019: 某个工具从以下位置返回了错误代码: "正在执行生成后事件..."

          然后上网查资料,搜到了stackoverflow上的一个相关帖子:

xcopyfile, rename, suppress “Does xxx specify a file name…” message

       一个大侠这样回答(最佳答案):

        xcopy isgenerally used when performing recursive copies of multiple files/folders, orwhen you need the verification/prompting features it offers. For single filecopies, the copy command works just fine.

       看来此处使用xcopy是杀鸡用牛刀了,果断改为:

copy  $(SDK_DLL)\$(ConfigurationName)\$(ProjectName)D.dll  $(SDK_BIN)\$(ConfigurationName)

        

            执行该命令就啥错误都没有了。






原文地址:https://www.cnblogs.com/lanzhi/p/6470602.html