First effort could use some tips.
Posted: 03 Sep 2013 18:02
Hey folks.
Decided to try and learn how to make some batch files. The idea came when my laptop fried and I hadn't got anything backed up. So, after I got my replacement laptop, I decided I wanted to make my own little "program" to backup my files for me. Along with my familys.
Now, I know there's plenty of stuff out there to do this for me. Heck eve my WD Passport 1tb came with software to do it automatically for me. But I wanted something new, and didn't mind the challenge. Plus I enjoy learning.
Anyway, after a few hours of studying the internet and its resources, I managed to come up with this so far. Problem is, it doesn't work lol. Hopefully by showing you, you'll see what I'm attempting to do. If not, please feel free to ask questions. I could use any and all help =).
Now, Please. Keep in mind that I have absolutely NO knowledge of programming. None, nada, nothin. I don't know syntax, I don't know anything period. So I apologize for my faults and failures in this code. I'm doing the best I can to learn, and this is the product of about 5 hours of study, and I still don't get any of it, other than the fact that I can now make a bat file that will back up all of these at once, but I wanted to try and give myself a little more option by creating a menu that provided me the ability to choose individual selections, or all of them at once.
Really appreciate any tips and advice. Explanations as to how this all works and why, or even direction towards something I can study to figure this all out would be much appreciated =)
Thanks.
D3l1v3ryb01
Decided to try and learn how to make some batch files. The idea came when my laptop fried and I hadn't got anything backed up. So, after I got my replacement laptop, I decided I wanted to make my own little "program" to backup my files for me. Along with my familys.
Now, I know there's plenty of stuff out there to do this for me. Heck eve my WD Passport 1tb came with software to do it automatically for me. But I wanted something new, and didn't mind the challenge. Plus I enjoy learning.
Anyway, after a few hours of studying the internet and its resources, I managed to come up with this so far. Problem is, it doesn't work lol. Hopefully by showing you, you'll see what I'm attempting to do. If not, please feel free to ask questions. I could use any and all help =).
Code: Select all
@echo off
color a
:start
cls
echo ~BACKUP MENU~
echo ***********************
echo * 1. Backup Documents *
echo * 2. Backup Pictures *
echo * 3. Backup Videos *
echo * 4. Backup Music *
echo * 5. Backup All *
echo ***********************
echo -By: D3l1v3ryb01-
echo "Enter your choice"
set /p choice= {1,2,3,4,5}
if /p '%choice%' ='1' goto :Backup Documents
if /p '%choice%' ='2' goto :Backup Pictures
if /p '%choice%' ='3' goto :Backup Videos
if /p '%choice%' ='4' goto :Backup Music
if /p '%choice%' ='5' goto :Backup All
:Backup Documents
if successful md G:\Backup
%backupcmd% "%USERPROFILE%\documents" "%drive%\Backup\Documents"
goto start
:Backup Pictures
if successful md G:\Backup
%backupcmd% "%USERPROFILE%\pictures" "%drive%\Backup\Pictures"
goto start
:Backup Videos
if successful md G:\Backup
%backupcmd% "%USERPROFILE%\videos" "%drive%\Backup\Videos"
goto start
:Backup Music
if successful md G:\Backup
%backupcmd% "%USERPROFILE%\music" "%drive%\Backup\Music"
goto start
if successful md G:\Backup
:Backup All
%backupcmd% "%USERPROFILE%\pictures" "%drive%\Backup\Pictures"
%backupcmd% "%USERPROFILE%\documents" "%drive%\Backup\Documents"
%backupcmd% "%USERPROFILE%\videos" "%drive%\Backup\Videos"
%backupcmd% "%USERPROFILE%\music" "%drive%\Backup\Music"
goto start
:exit
exit
Now, Please. Keep in mind that I have absolutely NO knowledge of programming. None, nada, nothin. I don't know syntax, I don't know anything period. So I apologize for my faults and failures in this code. I'm doing the best I can to learn, and this is the product of about 5 hours of study, and I still don't get any of it, other than the fact that I can now make a bat file that will back up all of these at once, but I wanted to try and give myself a little more option by creating a menu that provided me the ability to choose individual selections, or all of them at once.
Really appreciate any tips and advice. Explanations as to how this all works and why, or even direction towards something I can study to figure this all out would be much appreciated =)
Thanks.
D3l1v3ryb01