@echo off
cd \
if exist temp___?.txt del temp___?.txt
cd > temp___1.txt
echo C:\> temp___2.txt
fc temp___1.txt temp___2.txt > nul
if errorlevel 1 goto doit
echo %0 cannot create a backup batch-file on C:
echo change to the backup drive and run %0 there.
del temp___?.txt
goto dun

:doit
del temp___?.txt

echo @echo off> BKUP.bat
echo if not exist backup.drv echo Error!  Wrong disk logged.  Backup NOT run.>> BKUP.bat
echo if not exist backup.drv goto dun>> BKUP.bat
echo cd c-drive>> BKUP.bat
echo if not exist backup.dir echo Error!  Wrong disk\folder logged.  Backup NOT run.>> BKUP.bat
echo if not exist backup.dir goto dun>> BKUP.bat
echo echo Beginning Backup...>> BKUP.bat
echo xcopy c:\*.* . /s/d/c/v/y /EXCLUDE:\exclude.txt>> BKUP.bat
echo if exist "C:\Documents and Settings\*.*" xcopy "C:\Documents and Settings\*.*" "Documents and Settings\." /s/d/c/v/y/h /EXCLUDE:\exclude.txt>> BKUP.bat
echo if exist "C:\Users\*.*" xcopy "C:\Users\*.*" "Users\." /s/d/c/v/y/h /EXCLUDE:\exclude.txt>> BKUP.bat
echo echo ->> BKUP.bat
echo echo Backup Complete.>> BKUP.bat
echo echo Remember to turn off the external hard drive when you turn off your computer!>> BKUP.bat
echo :dun>> BKUP.bat
echo pause>> BKUP.bat

echo \i386\>exclude.txt
echo \winnt\>>exclude.txt
echo \windows\>>exclude.txt
echo \Cache\>>exclude.txt
echo \Temporary Internet Files\>>exclude.txt
echo \Program Files\>>exclude.txt
echo \Program Files (x86)\>>exclude.txt

echo backup.drv must be in the same folder as BKUP.bat>backup.drv
md c-drive
echo backup.dir must be in c-drive folder>c-drive\backup.dir

echo Double-click the BKUP.bat file to backup your C: drive
pause
:dun
