ALERT!
Click here to register with a few steps and explore all our cool stuff we have to offer!

Jump to content



Photo

A menu template I made in Batch.


  • Please log in to reply
A menu template I made in Batch.

#1

MKM2
MKM2
    Offline
    0
    Rep
    2
    Likes

    Rias-Sama Is A God.

Posts: 3
Threads: 3
Joined: Jan 23, 2018
Credits: 0
Six years registered
#1

DL: https://mega.nz/#!foJRVAjB!1GlBEu_1S4HYTDDZGBsulqi5zEzBGSUEFhXHk78709g

 

VirusTotal: https://www.virustotal.com/#/file/5b312af17c4f1cddd8069706cbb765d06c7387eca97a4a4a05d2d72abb458d11/detection

 

Source code:

@echo off
title Mortalkombatman2's Menu Template
color 0a



Rem PUT THIS IN THE START OF THE SCRIPT ALWAYS
setlocal enableextensions enabledelayedexpansion

for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do ( set "DEL=%%a"
)

Rem UP TO THIS POINT, ALSO YOU CAN REMOVE THESE COMMENTS



:Variables
Set SelectedExampleMenuOption=1


:ExampleMenu
cls
if %SelectedExampleMenuOption% == 1 (
call :SetSelectionColor 1a "[SELECTED] Example option 1"
echo.
) else (
echo Example option 1
)
if %SelectedExampleMenuOption% == 2 (
call :SetSelectionColor 1a "[SELECTED] Example option 2"
echo.
) else (
echo Example option 2
)
if %SelectedExampleMenuOption% == 3 (
call :SetSelectionColor 1a "[SELECTED] Exit"
echo.
) else (
echo Exit
)
echo.
echo ---------------------------------------------------------------
choice /c wsf /n /m "Keys: W = Up , S = Down, and F = Select"

if %ERRORLEVEL% == 1 goto ExampleMenuScrollUp
if %ERRORLEVEL% == 2 goto ExampleMenuScrollDown
if %ERRORLEVEL% == 3 goto ExampleMenuSelectOption

:ExampleMenuScrollUp
if %SelectedExampleMenuOption% == 1 (
Set SelectedExampleMenuOption=3
goto ExampleMenu
) else (
Set /a SelectedExampleMenuOption=%SelectedExampleMenuOption%-1
goto ExampleMenu
)

:ExampleMenuScrollDown
if %SelectedExampleMenuOption% == 3 (
Set SelectedExampleMenuOption=1
goto ExampleMenu
) else (
Set /a SelectedExampleMenuOption=%SelectedExampleMenuOption%+1
goto ExampleMenu
)

:ExampleMenuSelectOption
if %SelectedExampleMenuOption% == 1 goto ExampleOption1
if %SelectedExampleMenuOption% == 2 goto ExampleOption2
if %SelectedExampleMenuOption% == 3 goto Exit



:ExampleOption1
cls
echo You have selected example option 1.
echo.
echo Press any key to be taken back to the main menu.
pause>nul
goto ExampleMenu


:ExampleOption2
cls
echo You have selected example option 2.
echo.
echo Press any key to be taken back to the main menu.
pause>nul
goto ExampleMenu

:Exit
cls
color 0c
echo Goodbye.
ping -n 3 127.0.0.1>nul
exit



Rem MAKE SURE YOU HAVE THIS PART AT THE BOTTOM OF THE PROGRAM

:SetSelectionColor
echo off
<nul set /p ".=%DEL%" > "%~2"
findstr /v /a:%1 /R "^$" "%~2" nul
del "%~2" > nul 2>&1
goto :eof

Rem YOU CAN REMOVE THESE COMMENTS

Gyazo gif of the program: https://gyazo.com/38fed8c4771257c80aeed8a5d2309f99

 

Note: Yes, I realize this could be made better / more efficiently but I made this about a year ago when I was still in the process of learning Batch.


Edited by MKM2, 25 January 2018 - 12:17 AM.

  • 0

My Discord: Mortalkombatman2#1455


#2

Pinturillo
Pinturillo
    Offline
    0
    Rep
    0
    Likes

    Member

  • PipPipPip
Posts: 37
Threads: 0
Joined: Jan 26, 2018
Credits: 0
Six years registered
#2

Wow nice,ty


  • 0

#3

marcusfrank
marcusfrank
    Offline
    0
    Rep
    0
    Likes

    Member

  • PipPipPip
Posts: 26
Threads: 0
Joined: Jan 22, 2018
Credits: 0
Six years registered
#3

ty bro


  • 0


 Users browsing this thread: