Post-build event command line

Jan 23, 2013 at 9:34 AM


a newbie question: the first post-build event command line

echo F | xcopy "...\packages\Excel-DNA.0.30.3\tools\ExcelDna.xll" "$(TargetDir)Formula-AddIn.xll" /C /Y

would not work until I put an asterisk at the end of the target files' name. This seems to be correct due to xcopy behaviour not knowing if Formula-AddIn.xll would be a filename or directory. (It can be monitored on the output window).

So the correct line would be (note the asterisk):

echo F | xcopy "...\packages\Excel-DNA.0.30.3\tools\ExcelDna.xll" "$(TargetDir)Formula-AddIn.xll*" /C /Y

Am I missing a point here?
thank you for answering.


Jan 23, 2013 at 9:39 AM

Hi quad,

I think that's why I'm doing the "echo F | ...". I don't know why that doesn't work for you.

I didn't know a "*" in the target would work too. Do we you still need the "echo F | " in that case?


Jan 23, 2013 at 10:11 AM

Hi Govert,

thank you for your reply.
This seems to be the answer: Since you are copying a single file with a different file name, the echo command needs to know if the target would be a file or directory, which is usually prompted (as F = file, D = Directory) and has to be answered manually. The echo F pipe answers this question with F (for file) without prompting.

As I am working on a german windows 7 64 os, the prompt would be "(D = Datei, V = Verzeichnis)?" and thus remains unanswered by echo F (D would be right).

So the correct pipe command seems irritatingly to depend on the operating systems' language.

The idea with the asterisk is new to me too, I found it here (entry from bastla 30.04.2012 at 17:29:47).

This works fine for me, no echo pipe necessary:

xcopy "...\packages\Excel-DNA.0.30.3\tools\ExcelDna.xll" "$(TargetDir)Formula-AddIn.xll*" /C /Y


Jan 23, 2013 at 7:19 PM

Thanks - that's a neat trick!