Running a Batch File Using XCOPY

  • Thread starter Eckhart Schmidt
  • Start date
E

Eckhart Schmidt

I wrote what I thought was a simple batch file to copy a directory
("Timeprog") and all subfolders from my C: drive to my E:\ drive, The
following line was put into a batch file named "Timecopy.bat" which resides
on my C: drive.

XCOPY C:\TIMEPROG\ E:\TIMEPROG /S /E

When I run the file, a DOS window appears briefly, closes, but nothing
happens. What am I missing to make a working batch file, please?

Ed Aleks
 
S

Shenan Stanley

Eckhart said:
I wrote what I thought was a simple batch file to copy a directory
("Timeprog") and all subfolders from my C: drive to my E:\ drive,
The following line was put into a batch file named "Timecopy.bat"
which resides on my C: drive.

XCOPY C:\TIMEPROG\ E:\TIMEPROG /S /E

When I run the file, a DOS window appears briefly, closes, but
nothing happens. What am I missing to make a working batch file,
please?

When trying to write a batch script - make sure the commands actually work
when ran alone...

Try opening a command prompt and typing in the line you gave/are trying to
use. I bet you get something like:

Invalid path
0 File(s) copied

.... in return.

Now, type:

XCOPY /?

.... and press ENTER and read up on the command line options.

Then try:
XCOPY C:\TIMEPROG\*.* E:\TIMEPROG /S /E /I
 
N

nikola66

Eckhart said:
I wrote what I thought was a simple batch file to copy a directory
("Timeprog") and all subfolders from my C: drive to my E:\ drive, The
following line was put into a batch file named "Timecopy.bat" which resides
on my C: drive.

XCOPY C:\TIMEPROG\ E:\TIMEPROG /S /E

When I run the file, a DOS window appears briefly, closes, but nothing
happens. What am I missing to make a working batch file, please?

Ed Aleks

Always use dynamic pathes with such commands like:
%SystemDrive%
%WinDir% .........
this migh help.
NEO
 
P

Poprivet

Maybe it's because there is nothign there to keep the window open? either
put a "pause" after that line, or run the batch from the Command Prompt. By
keeping it open, you'll have a chance to look at any errors it presents.
Here's a sample of the type messages it provides:

Does F:\newdir specify a file name
or directory name on the target
(F = file, D = directory)?

HTH
Pop`
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Batch Files on DVD in XP? 2
xcopy file with time stamp 1
xcopy 9
Batch Files 4
Gui Xcopy Batch Command, Need advice 7
Quirky behaviour of batch file 2
xcopy batch 8
Problem with batch file for backup using xcopy 7

Top