Using call to make a menu [TUT]

View previous topic View next topic Go down

Using call to make a menu [TUT]

Post by Logic_Bomb on Mon May 18, 2009 7:26 pm

Ok, So you should know how to open up notepad and save as bat by now so I'll go ahead and crack on.

So open up you window and use the following (I will explain it all in a sec):

Code:

::This is the main batch file that all the other files will be called.
::This is a source designed and made by www.the-underground.darkbb.com
::So please give credits to us if modified.
::Thanks ok lets start.

:start
cls
@echo off
Echo This is a menu that will call other files.

::So lets show the options (Text)

Echo options:
Echo    1 - File one (Text then pause.)
Echo    2 - File two (ASCII ART then pause)
Echo    3 - File three (Message then exit.)
Echo.

::Echo. with the dot, makes a space.
::Just three for the moment, So lets set some user params.

Set /p USRINP= Select item [1/2/3]?

::Ok so lets use the param to call another batch file.

IF '%USRINP%' == '1' Call fileone.bat
IF '%USRINP%' == '2' Call filetwo.bat
IF '%USRINP%' == '3' Call filethree.bat
goto start


::The * as an option shows that if it is anything else it will goto the start using a marker.

Now save that as MAINMENU.bat

Now create three bat files named the following with the following code:

Fileone.bat:
Code:

::This is fileone just some text.
@echo off
echo Hello World.
pause > NUL

Filetwo.bat
Code:

@echo off
color 0a
echo                      ,
echo                      dM
echo                      MMr
echo                    4MMML                  .
echo                    MMMMM.                xf
echo    .              "M6MMM              .MM-
echo      Mh..          +MM5MMM            .MMMM
echo      .MMM.        .MMMMML.          MMMMMh
echo      )MMMh.        MM5MMM        MMMMMMM
echo        3MMMMx.    'MMM3MMf      xnMMMMMM"
echo        '*MMMMM      MMMMMM.    nMMMMMMP"
echo          *MMMMMx    "MMM5M\    .MMMMMMM=
echo          *MMMMMh  "MMMMM"  JMMMMMMP
echo            MMMMMM  GMMMM.  dMMMMMM            .
echo              MMMMMM  "MMMM  .MMMMM(        .nnMP"
echo  ..          *MMMMx  MMM"  dMMMM"    .nnMMMMM*
echo    "MMn...    'MMMMr 'MM  MMM"  .nMMMMMMM*"
echo    "4MMMMnn..  *MMM  MM  MMP"  .dMMMMMMM""
echo      ^MMMMMMMMx.  *ML "M .M*  .MMMMMM**"
echo          *PMMMMMMhn. *x  M  .MMMM**""
echo            ""**MMMMhx/.h/ .=*"
echo                      .3P"%....
echo                  nP"    "*MMnx
pause > NUL

Filethree.bat
Code:

echo Bye all :(
pause > NUL
exit

So i'll explain that for you the call funtion basically tells the batch file that the name you put after the call command is the BATCH file you would like it to open without opening a new window, the 1st batch file can use params from this file and will display it as basically a normal file.

Glossary:


Command Meaning
Call Opens another batch file into the existing one.
Cls Clears curent text.
Set /p sets a user param
param A paramiter.

Download for source and Exe:

http://the-underground.darkbb.com/hack-programming-downloads-f5/batch-menu-call-file-from-tut-source-exe-t10.htm#14

Hope you have enjoyed the tutorial.
Please comment.

Thanks

Kiz


Last edited by Admin on Mon May 18, 2009 9:40 pm; edited 1 time in total
avatar
Logic_Bomb
Admin
Admin

Posts : 161
Join date : 2009-05-12
Age : 25
Location : Cyberspace

View user profile http://the-underground.darkbb.com

Back to top Go down

Re: Using call to make a menu [TUT]

Post by Oliver on Mon May 18, 2009 7:32 pm

Nice!
Easy to understand and very informative.

REP++
Oliver.

Oliver
Admin
Admin

Posts : 8
Join date : 2009-05-14
Age : 23

View user profile

Back to top Go down

Batch Menu Call File (From TUT) [Source & Exe]

Post by Logic_Bomb on Mon May 18, 2009 9:39 pm

This is the batch menu call file from my tutorial on calling batch files [http://the-underground.darkbb.com/tutorials-f1/using-call-to-make-a-menu-tut-t8.htm]

It's zipped and has the source code and a compiled exe.



http://files.filefront.com/Call+File+Menuzip/;13776709;/fileinfo.html



----------------------------------------------------------------------------------
"Scan ""Shell extension scan"" was finished."
"No infection was found during this scan"
"Folders selected for scanning:";"C:\Users\****\Desktop\forum tuts\Call File Menu.zip;"
"Scan started:";"18 May 2009, 22:35:26"
"Scan finished:";"18 May 2009, 22:35:28 (2 second(s))"
"Total object scanned:";"7"
--------------------------------------------------------------------------------
"User who launched the scan:";"*****"
avatar
Logic_Bomb
Admin
Admin

Posts : 161
Join date : 2009-05-12
Age : 25
Location : Cyberspace

View user profile http://the-underground.darkbb.com

Back to top Go down

Re: Using call to make a menu [TUT]

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum