050598
This Month : 1154
Total Visit : 50598
Who's Online : 1

Ever wanted to make a nice script for backing up some stuff or just want to copy it.
With this example you can make a script with a nice menu in it.

 

First a screenshot of how it look like.
script

 

Next is the text you need to place in a notepad document.

@ECHO OFF
C:
CD\
CLS

:MENU
CLS

ECHO Place your own text here
ECHO.
ECHO Place an ECHO before every line
ECHO
ECHO
ECHO
ECHO
ECHO
ECHO
ECHO.

ECHO ========================= Backup script ============================
ECHO ———————————————————————–
ECHO 1. EXAMPLE: copy C:\data to F:\databackup
ECHO 2. option 2
ECHO 3. etc
ECHO.
ECHO ———————————————————————–
ECHO ======================== PRESS ‘Q’ TO QUIT ============================
ECHO.

SET INPUT=
SET /P INPUT=Please select a number:

IF /I ‘%INPUT%’==’1′ GOTO Selection1
IF /I ‘%INPUT%’==’2′ GOTO Selection2
IF /I ‘%INPUT%’==’3′ GOTO Selection3
IF /I ‘%INPUT%’==’4′ GOTO Selection4
IF /I ‘%INPUT%’==’5′ GOTO Selection5
IF /I ‘%INPUT%’==’6′ GOTO Selection6
IF /I ‘%INPUT%’==’7′ GOTO Selection7
IF /I ‘%INPUT%’==’8′ GOTO Selection8
IF /I ‘%INPUT%’==’9′ GOTO Selection9
IF /I ‘%INPUT%’==’Q’ GOTO Quit
IF /I ‘%INPUT%’==’q’ GOTO Quit

CLS

ECHO ======================== INVALID INPUT ===============================
ECHO ———————————————————————-
ECHO Please select a number from the Main
echo Menu [1-3] or select ‘Q’ to quit.
ECHO ———————————————————————-
ECHO =============== PRESS ANY KEY TO GO BACK TO MENU =====================
PAUSE > NUL
GOTO MENU

:Selection1

md F:\databackup

robocopy C:\data F:\databackup

GOTO OPTION

:Selection2
GOTO OPTION

:Selection3
GOTO OPTION

:Selection4

(COMMANDS)

:Selection5

(COMMANDS)

:Selection6

(COMMANDS)

:Selection7

(COMMANDS)

:Selection8

(COMMANDS)

:Selection9

(COMMANDS)

:Quit
exit
:OPTION

CLS
SET INPUT2=
SET /P INPUT2= Do you want to make another backup? (Y/N):
IF /I ‘%INPUT2%’==’Y’ GOTO MENU
IF /I ‘%INPUT2%’==’y’ GOTO MENU
IF /I ‘%INPUT2%’==’N’ GOTO END
IF /I ‘%INPUT2%’==’N’ GOTO END

CLS

ECHO ======================== INVALID INPUT ====================================
ECHO —————————————————————————
ECHO Please choose between the options Y or N
echo Y stands for yes and N for No
ECHO —————————————————————————
ECHO =============== PRESS ANY KEY TO GO BACK TO SELECTION =====================
PAUSE > NUL
GOTO OPTION
:END
ECHO.
ECHO ===============================BACKUP COMPLETED =====================================
ECHO ————————————————————————————-
ECHO ====================== PRESS ANY KEY TO CLOSE THIS WINDOW ===========================
ECHO ============================== REGARDS K-BASE TEAM ==================================

PAUSE>NUL
EXIT

 

Good luck with it!

 

 View Counter: (1643)