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

command linecommand-promptxcopy

This seems pretty simple and maybe I'm just overlooking the proper flag, but how would I, in one command, copy a file from one directory to another and rename it in the destination directory? Here's my command:

if exist "bin\development\whee.config.example"
  if not exist "TestConnectionExternal\bin\Debug\whee.config"
    xcopy "bin\development\whee.config.example"
          "TestConnectionExternal\bin\Debug\whee.config"

It prompts me with the following every time:

Does TestConnectionExternal\bin\Debug\whee.config specify a file name
or directory name on the target (F = file, D = directory)?

I want to suppress this prompt; the answer is always F.

Best Answer

I use

echo f | xcopy /f /y srcfile destfile

to get around it.