USING XCOPY COMMAND TO COPY 1 SINGLE FILE WITH .TXT TO CREATE A BATCH FILE

hI ALL,
i HAVE CREATED A BATCH FILE TO COPY ALL FILES, DIRECTORIES AND SUB DIRECTORIES AND THIS WORKED FINE.  nOW i WANT TO SETUP THE SAME TYPE FILE TO WORK WITH COPING 1 SINGLE FILE OVER BUT CAN'T GET IT TO WORK.  HERE IS WHAT I DID:

XCOPY C:\HOME\housing.mdf*.* Y:\TAAG-TIME-BU\TAAG\

THE THING IS ONCE I SAVE THE .TXT AS A BAT FILE AND DOUBLE CLICK IT, IT COMES UP AND GES AWAY QUICKLY NOT COPYING ANYTHING OVER.  i KNOW I'M DOING SOMETHING WRONG.
bsjldAsked:
Who is Participating?
 
mds-cosConnect With a Mentor Commented:
Looks like you have a syntex issue.  Try this:

"XCOPY C:\HOME\housing.mdf Y:\TAAG-TIME-BU\TAAG\"
0
 
Jeff BrownGlobal Helpdesk SupervisorCommented:
the other thing you can do to see what is actually occuring is to
goto   start
up to run
type in cmd  
press ok
and run your batch file from within the cmd console  that should show you what its doing and wehre its failing as the commands will stay in the window and the window won't poof on you.

--Wild
0
 
Steve KnightIT ConsultancyCommented:
(without the " around it there).

If you have adjusted the paths you may need to put "" around the paths though.

XCOPY "C:\HOME\housing.mdf" "Y:\TAAG-TIME-BU\TAAG"

I suggest you run it from the cmd.exe prompt once to see that it works for you.  It could be a matter of permissions, or if the file already exists for instance then you may need to add options to the xcopy line.

e.g.

xcopy /d/y "c:\home\housing.mdf" "y:\taag-time-bu\taag"

would copy the file if it is newer and overwrite without prompting.

Steve
0
 
TextReportCommented:
In you BAT file include PAUSE as the last line.
You may wish to include the /i parameter which advises that the destination is a directory

xcopy /i/y "c:\home\housing.mdf" "y:\taag-time-bu\taag"

Cheers, Andrew
0
All Courses

From novice to tech pro — start learning today.