1.

Solve : Batch File to Copy a File at Fixed Schedule?

Answer»

I want to copy a file called D:\EMPMST1.DBF to C:\COPYBAT every night at 2355 hrs.

Can someone help me prepare a Batch File to do the same?

Will the following work:
========================================
@echo off
echo This is a test batch file
cls
copy d:\empmst1.dbf c:\copybat
========================================

I have tried using the "AT" command in Windows 2000 to run at a specific TIME.

I want the computer to run this batch file everyday and copy and overwrite the file.

Regards,

YpschitaCode: [Select]@echo off
echo This is a test batch file
cls
copy /Y d:\empmst1.dbf c:\copybat

Note: Not sure if W2K has a Y switch (overwrite) for the COPY cmd. If not you can always pipe a Y:

Code: [Select]@echo off
echo This is a test batch file
cls
echo Y | copy d:\empmst1.dbf c:\copybat

To schedule the job something like this MIGHT work:

at 23:55 /every:M,T,W,Th,F,S,Su batchname.bat

Replace batchname with the name of your batch file and add any ADDITIONAL path information as needed.

8-)Or you could simply run it from the task scheduler.
start/programs/accessories/system tools/scheduled tasksDear Sidewinder,

It did not work. I put it for 4:45PM IST and the time has passed but nothing worked.

Any suggestions?

2K_Dummy,

I am trying your solution too.

Regards,When you ran the AT command, did the job get scheduled? ERROR message? Use military time when scheduling jobs with the AT command.

8-)Sidewinder, 2K_dummy,

Thanks it worked. Now I will just check the overwrite thing.

I used Military Time only but still it did not run.

The AT did not work, I went to the Scheduler and started it.

It worked well.

The AT command made it think it has to run WEEKLY and not DAILY.

Thanks a lot!!!!

Regards, I also need to copy a folder at a CERTAIN time, but can I also delete the copyed folder at another time?Create two batch files, one for the copy, the other for the delete. Schedule each job at described above.

8-)thanks!Hey, Sidewinder, Is there a way to just overwrite the same file instead of deleting it?



Discussion

No Comment Found