![]() |
|
[Shell] TUTORIAL: how to make a batch menu - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [Shell] TUTORIAL: how to make a batch menu (/showthread.php?tid=1095271) |
TUTORIAL: how to make a batch menu - MDSN productions - Feb 27, 2011 Hello,β In this tutorial I will show you how to make a menu using notepad the menu is: name and password protected Open notepad and copy the following lines, then save the file as MENU.bat NOTE you still need to change a few things ::menu :: @echo off title Personal Menu color b cls :password set input= set /p input=Password if %input%=='set for yourselve' goto yes if not %input%=='set for yourselve' goto no :yes cls echo Acces Accepted! Welcome 'make your own choice' echo. set /p op=Enter Your Full Name For Acces if %op%=='enter your full name' goto home :no echo Wrong Password. Acces Denied. No Entry goto password :home color b title 'name' his Space--Home Page cls echo. echo Welcome back 'make your own choice'! Choose an Application echo == echo. echo 1)Documents echo 2)Youtube echo 3)Hackforums echo 4)Winrar echo 5)Calculator echo 6)Command Prompt echo 7)Google echo. echo == set /p value=Enter Numeral Option if %value%==1 goto documents if %value%==2 start www.youtube.com if %value%==3 start hackforums.net if %value%==4 start WinRAR.exe if %value%==5 start calc.exe if %value%==6 start cmd.exe if %value%==7 start www.google.be goto error :documents cls title My Documents echo. echo == echo My Documents echo == echo. echo select a folder: echo == echo. echo 1)Playstion 3 echo 2)Music echo 3)Other echo 4)Go back echo. echo == echo. set /p var=Enter Numeral Option: if %var%==1 start C:\Users\Michiel\Documents\PS3 if %var%==2 start C:\Users\Michiel\Documents\Muziek if %var%==3 start C:\Users\Michiel\Documents\Andere if %var%==4 goto home goto error :error cls color b echo Numeral Option Not Valid pause >nul cls goto home 'Muziek' and 'Andere' are the same as Music and Other but because I live in Belgium my computer has everything named in Dutch Now the explanation ::menu This is just for myself to help me remember what the :: batch does if I edit it, you can leave it if you want -- @echo off to leave away the other echo's title Program Fire Wall give your screen a title color b give the text a nice colour (1-10 or a-f) cls clear the screen -- :password set input= set /p input=Password if %input%=='set for yourselve' goto yes if not %input%=='set for yourselve' goto no in this part you have to delete the quotes and set for yourselve and type a password NOTE: the password needs to be the same eg :password set input= set /p input=Password if %input%==hacker goto yes if not %input%==hacker goto no -- title 'name' his Space--Home Page don't forget to change the name and delete the quotes ;) There will be other things like this in the code, take a close look and change everthing that needs to be changed -- :password these are all subdivisions of your batch :documents the commands after these parts are not :yes used unless when reffered to with :no goto password, goto documents etc. -- set input= you want to make some options set /p input=Password the 'set /p' part is standard, only input can be changed e.g. set /p whatever when changing input into whatever you will also need to change the if%input%== into if%whatever%== -- if %input%==A goto yes if %x% is standard, it doesn't matter what the x is, but it has to be the same as the set /p x if not %input%==B goto no if not %x% is also standard, feel free to change the x but make sure it remains the same within that part of the code e.g. if %whatever%==A goto yes if %whatever%==B goto no if %whatever%==C exit THIS IS NOT POSSIBLE!!!: if %whatever%==A goto yes if %somthing%==B goto no if %anything%==C exit the text between the %'s needs to be the same! -- echo Welcome back 'user' ! Choose an Application echo == echo. echo. gives you a blank line echo 1)Documents you can choose the options you want echo 2)Youtube echo 3)Hackforums echo 4)MSN startpagina echo 5)Calculator echo 6)Command Prompt echo 7)Google set /p value=Enter Numeral Option if %value%==1 goto documents if %value%==2 start www.youtube.com if %value%==3 start hackforums.net if %value%==4 start http://be.msn.com/default.aspx if %value%==5 start calc.exe if %value%==6 start cmd.exe if %value%==7 start www.google.be goto error this is very easy and explained in one of the other steps, if you want to start a program you will need the exe how to get the .exe You need to go to the program you want and click on it with the right mouse button and go to properties > shortcut and copy the last part e.g. for Winrar "C:\Program Files\WinRAR\WinRAR.exe" we need the WinRAR.exe to open winrar (no quotes!) -- :error when you type a different number than cls possible you will be redirected to this color b because of the goto error echo Numeral Option Not Valid this will redirect you to the :home pause >nul were you can choose another option cls goto home -- NOTE: if %var%==1 start C:\Users\Michiel\Documents\PS3 this is set to my documents, change it to match you own Also don't forget to change the name and password in the codes so you can copy them but you will need to check them very carefully You can make this as big as you want, If explained how this works so it shouldn't be a problem π That's it, let me know if there is something not clear π after changing everything it should look like this ::menu :: @echo off title Program Fire Wall color b cls :password set input= set /p input=Password if %input%==michiel goto yes if not %input%==michiel goto no :yes cls echo Acces Accepted! Welcome Michiel echo. set /p op=Enter Your Full Name For Acces if %op%==MichielDSN goto home :no echo Wrong Password. Acces Denied. No Entry goto password :home color b title Michiel's Space--Home Page cls echo. echo Welcome back Michiel! Choose an Application echo == echo. echo 1)Documents echo 2)Youtube echo 3)Hackforums echo 4)MSN startpagina echo 5)Calculator echo 6)Command Prompt echo 7)Google echo. echo == set /p value=Enter Numeral Option if %value%==1 goto documents if %value%==2 start www.youtube.com if %value%==3 start hackforums.net if %value%==4 start http://be.msn.com/default.aspx if %value%==5 start calc.exe if %value%==6 start cmd.exe if %value%==7 start www.google.be goto error :documents cls title My Documents echo. echo == echo My Documents echo == echo. echo select a folder: echo == echo. echo 1)Playstion 3 echo 2)Muziek echo 3)Andere echo 4)Go back echo. echo == echo. set /p var=Enter Numeral Option: if %var%==1 start C:\Users\Michiel\Documents\PS3 if %var%==2 start C:\Users\Michiel\Documents\Muziek if %var%==3 start C:\Users\Michiel\Documents\Andere if %var%==4 goto home goto error :error cls color b echo Numeral Option Not Valid pause >nul cls goto home * - Vyspeiro - Feb 27, 2011 (Feb 27, 2011 01:53 PM)MDSN productions Wrote: set /p value=Enter Numeral OptionI found a little glitch here. If you'd start 2-7, it would go to error, because after it does the if statement it will just move onto the other thing, which tells it to goto error. You could fix this by adding goto's to each if statement, but it is just a little thing. * - Sothe - Feb 27, 2011 You know there are code brackets, right? Nice tutorial, besides the error above. * - Dezzz - Feb 27, 2011 Please start using {code} code goes here {/code} Replace "{" and "}" with "[" and "]". Code To get thisAnd if you want to be super mega neat, use spoilers. {spoiler=Part 1} Content of spoiler {/spoiler} Part 1 (Click to View) * - MDSN productions - Feb 27, 2011 (Feb 27, 2011 08:39 PM)Dezinated Wrote: Please start using could you give an exemple of what should go between {code}{/code} and "["and"]" and {spoiler=Part 1} Content of spoiler {/spoiler} please use an exemple out of my tutorial because I don't really get itπΆ (Feb 27, 2011 02:06 PM)Vyspeiro Wrote: I found a little glitch here. thanks, I'll see what I can do and will update the thread. (Feb 27, 2011 06:48 PM)Sothe Wrote: You know there are code brackets, right? Could you give an exemple please? use some text out of my tutorial so I can understand. * - Dezzz - Feb 28, 2011 Copy This (Click to View) * - Sothe - Feb 28, 2011 I mean there are code brackets so you can organize code that you put in. Because without them, it's really sloppy. It would make your topic a little more organized. * - MDSN productions - Feb 28, 2011 (Feb 28, 2011 12:47 AM)Dezinated Wrote: Copy This (Click to View) ah, I get it. I will remember it for the next thread (which will probebly be the updated version of this one) I thought you ment I should have used spoiler and code in my batch file... But I get it now, thanks for the tip * - MDSN productions - Mar 3, 2011 visit https://hackforums.net/showthread.php?tid=1102741 for my new thread and new menu the glitch is gone and the coding is much, much better |