Showing posts with label batch file. Show all posts
Showing posts with label batch file. Show all posts

Tuesday, 25 February 2014

Back up with a Batch file

Back up with a batch file:
This batch file has a menu and an Unattended option.



I have created this back up with a menu i created this batch file for my own personal PC, but you may copy, paste and modify it to suit your own needs.

Points to remember when modifying
Use the correct user and drive letters and paths.
Email path directories will vary  from user to user and is also dependent on the email program used.
(For instance my email is  program is microsoft outlook and the data file -PST- is located in Outlook folder in root directory of my C: drive.- not standard but that is where mine is.)

copy from here


@echo off
@color F9
title DurbanGeek BACK IT UP 2.0



:MAINMENU
mode con: cols=50 lines=21
CLS
echo.
echo.
echo.    DURBANGEEK ~  IT Solutions  0711035273
echo.    Durbangeek Custom BACK IT UP Utility
echo.     **********Kenny Godfrey***********
echo.
echo.
echo.              A. Back Up Documents
echo.              B. Back Up Pictures
echo.              C. Back Up Email
echo.              D. Back Up Desktop
echo.              E. Back Up *****
echo.              F. Back Up *****
echo.              G. Back Up Google Drive
echo.              H. Back Up Everything (Unattended)
echo.              Q. Quit
:CHOOSEACTION
echo.
set /p userinp=    ^   Make your selection:
set userinp=%userinp:~0,1%
if /i "%userinp%"=="A" goto Documents
if /i "%userinp%"=="B" goto Pictures
if /i "%userinp%"=="C" goto Email
if /i "%userinp%"=="D" goto Desktop
if /i "%userinp%"=="E" goto *****
if /i "%userinp%"=="F" goto *****
if /i "%userinp%"=="G" goto Google Drive
if /i "%userinp%"=="H" goto Everything
if /i "%userinp%"=="Q" goto Quit
echo.Try Again...
GOTO CHOOSEACTION

:Documents
mode con: cols=128 lines=42
title BACK IT UP  2.0
echo ********* Please make sure  all Documents are saved and closed. *********
echo ********* Press a key to continue ********
pause
echo.    Backing up Documents !!!!!!!
xcopy  C:\Users\User\Documents\*.* H:\DGBackup\Documents\ /D/S/H/V/C/F/K/Y
echo.
echo.Documents back up completed :)
echo.
echo ************Press any key to return to the main menu*************
PAUSE 1>nul
GOTO MAINMENU
)
echo ************Press any key to return to the main menu*************

:Pictures
mode con: cols=128 lines=42
title DurbanGeek BACK IT UP  2.0
echo ********* Please make sure  all Pictures are closed. *********
echo ********* Press a key to continue *********
pause
echo.    Backing up Pictures !!!!!!!
xcopy  C:\Users\User\Pictures\*.* H:\DGbackup\Pictures\ /D/S/H/V/C/F/K/Y
echo.
echo. Pictures back up completed :)
echo Press any key to return to the main menu
PAUSE 1>nul
GOTO MAINMENU
)
echo ************Press any key to return to the main menu*************

:Email
mode con: cols=128 lines=42
title DurbanGeek BACK IT UP  2.0
echo ********* Please make sure  Microsoft Outlook is closed *********
echo ********* Press a key to continue *********
pause
echo.    Backing up Email !!!!!!!
xcopy C:\Outlook\*.* H:\DGbackup\Outlook\  /D/S/H/V/C/F/K/Y/Z
echo.
echo.  Email back up completed :)
echo.
echo Press any key to return to the main menu
PAUSE 1>nul
GOTO MAINMENU
)
echo ************Press any key to return to the main menu*************

:Desktop
mode con: cols=128 lines=42
title DurbanGeek BACK IT UP  2.0
echo.    Backing up Desktop !!!!!!!
xcopy  C:\Users\User\Desktop*.* H:\DGbackup\Desktop /D/S/H/V/C/F/K/Y
echo.
echo.  Desktop back up completed :)
echo.
echo.Press any key to return to the main menu
pause > nul
GOTO MAINMENU
)
echo ************Press any key to return to the main menu*************

:Google Drive
mode con: cols=128 lines=42
title DurbanGeek BACK IT UP  2.0
echo.    Backing up Google Drive !!!!!!!
xcopy  "C:\Users\User\Google Drive\*".* "H:\DGbackup\Google Drive\" /D/S/H/V/C/F/K/Y
echo.
echo.  Google Drive back up completed :)
echo.
echo.Press any key to return to the main menu
pause > nul
GOTO MAINMENU
)
echo ************Press any key to return to the main menu*************

:Everything
mode con: cols=128 lines=42
title DurbanGeek BACK IT UP  2.0

echo.     * * * * Backing up Documents !!!!!!! * * * *
xcopy  C:\Users\User\Documents\*.* H:\DGBackup\Documents\ /D/S/H/V/C/F/K/Y
echo.
echo.  Documents back up completed :)
echo.
echo.     * * * * Backing up Pictures !!!!!!! * * * *
xcopy  C:\Users\User\Pictures\*.* H:\DGbackup\Pictures\ /D/S/H/V/C/F/K/Y
echo.
echo.  Pictures back up completed :)
echo.
echo.
echo.    * * * * Backing up Email !!!!!!! * * * *
xcopy C:\Outlook\*.* H:\DGbackup\Outlook\  /D/S/H/V/C/F/K/Y/Z
echo.
echo.  Email back up completed :)
echo.
echo.
echo.     * * * * Backing up Desktop !!!!!!! * * * *
xcopy  C:\Users\User\Desktop*.* H:\DGbackup\Desktop\ /D/S/H/V/C/F/K/Y
echo.
echo.  Desktop back up completed :)
echo.
echo.
echo.     * * * * Backing up Google Drive !!!!!!! * * * *
xcopy  "C:\Users\User\Google Drive\"*.* "H:\DGbackup\Google Drive\" /D/S/H/V/C/F/K/Y
echo.
echo.  Google Drive back up completed :)
echo.
echo.
echo.  Unattended BACK IT UP up was completed :)
echo.Press any key to return to the main menu
pause > nul
GOTO MAINMENU
)
:Quit


 ↑ copy to here ↑



Instructions :
Open a new text docunent.
Paste  text into document
Select file then save as
Change the name to BackUp.bat (remove the .txt)and save to the desktop
The icon should look something like this             >>>>>

Now assuming that you have edited the commands correctly you will now be able to back up a folder or do a complete unattended backup.




Thursday, 13 June 2013

How to Password Protect a Folder Using a simple Batch File


This tutorial will guide you through the steps required to create a locked folder in Windows 7 – without installing any additional 3rd party software.
While the steps below will guide you in creating a hidden and password protected folder, this method is not 100% secure. It will deter the average computer user enough, but an advanced user will be able to access the contents of this folder. If you want to create a truly secure and encrypted place to store files and folders that absolutely nobody will ever be able to access, see the tutorial
  1. Create a new folder and name it whatever you would like.
  2. lock folder example
  3. Open the folder, right-click on a blank area in it, then select New -> Text Document from the pop-up menu.

  4. Open the text file you just created by double-clicking it and copy/paste in the following text:
    cls
    @ECHO OFF
    title Folder Private
    if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
    if NOT EXIST Private goto MDLOCKER
    :CONFIRM
    echo Are you sure you want to lock the folder(Y/N)
    set/p "cho=>"
    if %cho%==Y goto LOCK
    if %cho%==y goto LOCK
    if %cho%==n goto END
    if %cho%==N goto END
    echo Invalid choice.
    goto CONFIRM
    :LOCK
    ren Private "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
    attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
    echo Folder locked
    goto End
    :UNLOCK
    echo Enter password to unlock folder
    set/p "pass=>"
    if NOT %pass%== PASSWORD_GOES_HERE goto FAIL
    attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
    ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Private
    echo Folder Unlocked successfully
    goto End
    :FAIL
    echo Invalid password
    goto end
    :MDLOCKER
    md Private
    echo Private created successfully
    goto End
    :End
  5. In the above code, replace the key PASSWORD_GOES_HERE with the password you want to use to unlock the folder. For example if you want the password to be 123456, the line should look like:
    if NOT %pass%== 123456 goto FAIL
  6. Save your new file in the .bat format with the complete file name being locker.bat. To do this, make sure to change the Save as type: to All Files (*.*).
  7. Save file text file as a batch file
    click to enlarge
  8. In the folder you created back in Step #1, double click the locker.bat file and there will now be a new folder named Private where you can put anything you want.
  9. private folder and batch file
  10. Upon exiting, double click the locker.bat file again. It will prompt you to answer whether you want to lock your folder or not. Press Y and the private folder will disappear.

  11. click to enlarge
  12. In order to retrieve the Private folder, all you have to do is double click the locker.bat file and enter the password which you set in Step #4 and the folder will appear again for you to access.

  13. click to enlarge
  14. That’s it!