How To Write A One liner Script for Backup Files in Windows


Scripting always make tasks easier. The below script helps you in a way that you do not have to manually go to the location and copy the files and paste in external drive or any other destination. You just have to run this script in command prompt. which does automatically all your work. This is just a basic scripting, you may add more functions into it.

How To Write A One liner Script for Backup Files in Windows
How To Write A One liner Script for Backup Files in Windows


We use xcopy to do this tasks.


1- Open Notepad
2- Write as I mentioned below:

 @echo off
color 1e
xcopy D:\test1\*.* E:\test2\ /E /Y
echo Backup Completed!

Here we copying data from D:\test1 this location to E:\test2 .

3- Save this file as Backup.bat on your desktop.
4- Open command prompt - Goto Run and type cmd then hit enter.
5- Type cd desktop (we have saved backup.bat script on desktop)
6- Type backup.bat and enter


You could see that all files have been copied to the destination folder without doing manually.!

Isn't it really helpful.?



Comments