BATCH file asks for file or folder

just me picture just me · Nov 26, 2010 · Viewed 127.7k times · Source

I have a simple copy from to script for one of our guys who's missing a file 20km from my desk

when testing the script out I am prompted if my file shapes.atc is a file or a folder

I can tell you that its a file but how can I autocopy it over my guy needs to be able to just click the batch finished

xcopy /s/y J:\"My Name"\"FILES IN TRANSIT"\JOHN20101126\"Missing file"\Shapes.atc C:\"Documents and Settings"\"His name"\"Application Data"\Autodesk\"AutoCAD 2010"\"R18.0"\enu\Support\Shapes.atc

Answer

Govert picture Govert · Jan 23, 2013

A seemingly undocumented trick is to put a * at the end of the destination - then xcopy will copy as a file, like so

xcopy c:\source\file.txt c:\destination\newfile.txt*

The echo f | xcopy ... trick does not work on localized versions of Windows, where the prompt is different.