xcopy file, rename, suppress "Does xxx specify a file name..." message
There is some sort of undocumented feature in XCOPY. you can use:
xcopy "bin\development\whee.config.example" "c:\mybackup\TestConnectionExternal\bin\Debug\whee.config*"
i tested it just today. :-)
Another option is to use a destination wildcard. Note that this only works if the source and destination filenames will be the same, so while this doesn't solve the OP's specific example, I thought it was worth sharing.
For example:
xcopy /y "bin\development\whee.config.example" "TestConnectionExternal\bin\Debug\*"
will create a copy of the file "whee.config.example" in the destination directory without prompting for file or directory.
Update: As mentioned by @chapluck:
You can change "* "
to "[newFileName].*"
. It persists file extension but allows to rename. Or more hacky: "[newFileName].[newExt]*"
to change extension
Don't use the xcopy
, use copy
instead, it doesn't have this issue.
xcopy
is generally used when performing recursive copies of multiple files/folders, or when you need the verification/prompting features it offers. For single file copies, the copy
command works just fine.
I use
echo f | xcopy /f /y srcfile destfile
to get around it.