Batch menu with buttons

June 18, 2011 at 11:29:28
Specs: Windows 7
I want to create a program with menu.
4 exmple:
What do you want to do?
1. Shutdown PC
2. Restart PC
3. Format C:\
4. Format D:\
5. Exit
The normal menu script 4 this would be something like that:
@echo off
echo What do you want to do?
echo 1. Shutdown PC
echo 2. Restart PC
echo 3. Format C:\
echo 4. Format D:\
echo 5. Exit
set /p normalmenu=
if %normalmenu%==1 goto 1
if %normalmenu%==2 goto 2
if %normalmenu%==3 goto 3
if %normalmenu%==4 goto 4
if %normalmenu%==5 exit
shutdown -s -t 1
shutdown -r -t 1
format "C:\"
format "D:\"

BUT I need that the menu for this program would be like, pressing with the mouse on the "restart PC" and PC will restart...
Something like that:

I am using windows 7 32bit
Dont konw if that's possible in windows7...

Thankyou for any kind of help

See More: Batch menu with buttons

Report •

June 18, 2011 at 11:55:29
batch files are command line driven...perhaps a basic menu with 1,2,3,4? its just as easy to type 1 letter and hit enter?


Report •

June 18, 2011 at 12:10:36
NO. I need that there were buttons...
And it is the one i want.
Thankyou for information

Report •

June 18, 2011 at 14:23:50
I may be wrong but a batch can't have buttons. That looks like a script driven program. You can make a menued program that runs batches, whether it returns to the menu depends on the program

Report •

Related Solutions

June 18, 2011 at 19:23:22
That script uses debug to get mouse input, which leaves a few problems:

1. It eats lots resources, even when idle, because it has to constantly loop to check for mouse input.
2. It doesn't easily allow for keyboard input in addition to mouse input.
3. If the user has "Quick Edit" enabled by default in the console options they will have to change the console settings to use the mouse this way.
4. Debug isn't usable on 64bit systems.

If you're fine with all of these issues then download their script (available in the comments of the youtube video) and modify the mouse handling code for your purposes.

If an outside executable is a possibility you may want to have a look at a utility I wrote:

rem note the space after '\'
rem it could also be "format d:\\"
cmdmenusel # "Shutdown PC" "Restart PC" "Format C:\ " "Format D:\ " Exit
if %errorlevel%==1 goto 1
if %errorlevel%==2 goto 2
if %errorlevel%==3 goto 3
if %errorlevel%==4 goto 4
if %errorlevel%==5 exit

Report •

September 5, 2011 at 04:34:25
how to make menu without "CMDMENUSEL"?
And not using NUMBER menu?

Report •

September 5, 2011 at 04:46:51
If Judago didnt posted his reply, I was going to refer it to his tool :P

Just try Judago's tool, it works excellent.

CmdMenuSel is a great tool that I use alot :)


Happy is ONE who says I am an OttoMAN.

Report •

September 5, 2011 at 14:25:22
how to make menu without "CMDMENUSEL"?
And not using NUMBER menu?

You don't. Batch files are executed in a CLI environment, and mice are GUI tools. If you want to use GUI tools, switch to a GUI environment. VBScript/JScript with IE is the obvious choice. Outside of that, there are a number of programming languages that'll let you do what you want.

How To Ask Questions The Smart Way

Report •

September 5, 2011 at 23:45:46
Here is the debug solution used in the script you linked(slightly modified):

@echo off
SetLocal EnableDelayedExpansion

Echo e100 B8 1 0'3'DB CD'3'B0 3'C'CD'3'B DB't'FA 91 D3 EA D3 E8 91 C3>mouse.dat
For %%! in (.g116 .q) do (Echo%%!>> mouse.dat)
For /f "tokens=6-8 delims== " %%a in ('Debug ^< mouse.dat ^| Find /I "X"') do (
Set /a "X=0x%%a"
Set /a "Y=0x%%c"
Set /a "G=!Y! * 160 + (!X! + 1 - 1) * 2
echo !x!,!y!
Goto :mouse

See the list of problems I posted above.

Report •

Ask Question