How backup all your files, using Xcopy command?
| Syntax | |
| xcopy | copy |
Description:-
To view all parameters type c:\windows\system32\xcopy/?
Examples:-
xcopy c:\main\*.* c:\bat
Sample programme 1:-
@ECHO OFF
:: copy all files from different directory to c:\backup
xcopy /s c:\main1\*.* c:\bat
xcopy /s c:\main2\*.txt c:\backup
xcopy /s c:\main3\*.jpg c:\backup
xcopy /s c:\main4\*.exe c:\backup
xcopy /s c:\main5\*.txt c:\backup
cls
:end
Sample programme 2:-
Note:
@echo off
if "%1" == "" goto msg
if "%1" == "" goto msg
xcopy %1 %2 /s /e
if errorlevel 4 goto lowmemory
if errorlevel 2 goto abort
if errorlevel 0 goto exit
:lowmemory
echo Insufficient memory to copy files or
echo invalid drive or command-line syntax.
goto exit
:abort
echo You pressed CTRL+C to end the copy operation.
goto exit
:msg
Type from directory c:\main1\*.* to backup c:\backup
pause
echo y| xcopy c\main\*.doc c:\backup\doc
echo y| xcopy c\main\*.jpg c:\backup\image
echo y| xcopy c\main\*.txt c:\backup\text
Note:-
copy all DOC , JPG, Text file to c:\main\doc directory without prompting Yes or no .
NOTE:- after Y and PIPE sign in keyboard shift backslash.

No comments:
Post a Comment