1.

Solve : Help with creating a batch file?

Answer»

hi all, mock exam question, im a bit rusty with DOS so any help recieved with thanks.

the question:

write an ms-dos batch file that will copy the large file MOVEME.TXT from the directory C:\ORIG\TXT to the empty directory C:\NEW\TXT and deletethe file C:\ORIG\TXT\COPY.SEM if the copy was successful.

i have created a file called moveme.bat in c:\moveme.bat

the following contained in the moveme.bat file

copy c:\orig\txt\moveme.txt, c:\new\txt
del c:\orig\txt\copy.sem

this WORKS,but if the moveme.txt file was not copied correctly, it would still delete the copy.sem file.


Anyone able to help me please so i can get my head around this.

many thanks

[emailprotected]copy c:\orig\txt\moveme.txt, c:\new\txt
if exist c:\new\txt\moveme.txt del c:\orig\txt\copy.sem

or

copy c:\orig\txt\moveme.txt, c:\new\txt && del c:\orig\txt\copy.sem

I have never tried the 2nd example, I understand the 2nd statement only executes if the first worked

But what will you do in your exam ? I wont be there !!
Grahamthank you for your reply, i used the VERIFY option in copy which worked as well.
i will play with your option as well, taught me SOMETHING today, many thanks PAUL



Discussion

No Comment Found