Creating Batch File in Dos

how can make a batch file script that can copy the 2 files in every dir including subdirectory...and one more thing is there a way how to install DOS 7.0 in windows xp so can use the deltree command...thanks!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

use rmdir instead of deltree

batch file:
@echo off
for /r %%a in (.) do (
  copy c:\onefile.txt "%%a"
  copy c:\twofile.txt "%%a"

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Lee W, MVPTechnology and Business Process AdvisorCommented:
to expand on sirbounty's rmdir comment -

rmdir and rd are essentially synonymous.

RD /S will do the same thing deltree used to do.  For more information, just type RD /?
These are the results of rd /?

here is an example of this:

rd /s /q f:temp\one      (This will delete folder one without asking you: are you sure (y/n)? It will dispose all the files and directories below it...)

C:\Users\temp>rd /?                                                         Removes (deletes) a directory.                                                                                                                          RMDIR [/S] [/Q] [drive:]path                                                RD [/S] [/Q] [drive:]path                                                                                                                                   /S      Removes all directories and files in the specified directory                in addition to the directory itself.  Used to remove a directory            tree.                                                                                                                                           /Q      Quiet mode, do not ask if ok to remove a directory tree with /S

Good luck.
PMI ACP® Project Management

Prepare for the PMI Agile Certified Practitioner (PMI-ACP)® exam, which formally recognizes your knowledge of agile principles and your skill with agile techniques.

hiya zaldhie

to answer both questions....and not wishing to step on either sirbounty's toes nor leew's toes...

1) batch file to copy two files to every directory on the drive and log errors

@echo off

echo Could not copy files to the following directories: >LOGFILE

for /r \ %%a in (.) do (
  echo Copying files to %%a

  copy FILE1 "%%a" >nul
  if not %errorlevel%==0 echo FILE1 %%a >>LOGFILE

  copy FILE2 "%%a" >nul
  if not %errorlevel%==0 echo FILE2 %%a >>LOGFILE

notice the subtle difference in the second line. also, this batch file assumes FILE1 and FILE2 are in the same directorey as this batch file.

after running the batch file you can examine the LOGFILE in notepad to determine where it was not permissible to copy either or both files FILE1 and FILE2.

2) the DELTREE command was excluded from both Windows 2000 and Windows XP. instead, the internal RD command now includes the /S and /Q switches.

the /S switch removes all sub-directories as well as the target directory.
the /Q switch suppresses user confirmation prompts.

the following command does what DELTREE did

rd /s /q c:\DIRECTORY
zaldhieAuthor Commented:
thanks a lot guys!... i know where can i find a solution for my problem :P more power
Please be clearer and more specific with your question....
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Batch

From novice to tech pro — start learning today.