- @echo off
- echo.
- if X%2 == X goto SYNTAX
- if exist %2\nul goto SAVE
- echo The removable disk must not be present.
- echo 2s of attempt.
- break
- if exist %2\nul goto SAVE
- echo The removable disk must not be present.
- echo Backup not performed. End of treatment.
- echo.
- break
- go to END
- :SAVE
- rem choice "Do you want to back up %1 to %2" /T:O,30
- if errorlevel 2 goto end
- echo Backup in progress...
- echo.
- rem XCOPY %1\*.* %2 /D /E /F
- XCOPY %1\*.* %2 /D /E /Y
- echo.
- if errorlevel 2 goto ERROR
- go to END
- :ERROR
- echo.
- echo An error has occurred!
- echo Directory backup not complete.
- echo.
- break
- go to END
- :SYNTAX
- echo.
- echo Syntax: backup.bat source target
- echo with source which is the directory to save
- echo and target which is the backup directory
- echo.
- break
- :END
- echo.
Raw Paste