Computing Staff
  • 0

Batch Menu With Buttons

  • 0

<td><p></p>I want to create a program with menu.<br>4 exmple:<br>===========================================================<br>What do you want to do?<br>1. Shutdown PC<br>2. Restart PC<br>3. Format C:\<br>4. Format D:\<br>5. Exit<br>===========================================================<br>The normal menu script 4 this would be something like that:<br>@echo off<br>echo What do you want to do?<br>echo 1. Shutdown PC<br>echo 2. Restart PC<br>echo 3. Format C:\<br>echo 4. Format D:\<br>echo 5. Exit<br>set /p normalmenu=<br>if %normalmenu%==1 goto 1<br>if %normalmenu%==2 goto 2<br>if %normalmenu%==3 goto 3<br>if %normalmenu%==4 goto 4<br>if %normalmenu%==5 exit<br>:1<br>shutdown -s -t 1<br>exit<br>:2<br>shutdown -r -t 1<br>exit<br>:3<br>format “C:\”<br>exit<br>:4<br>format “D:\”<br>exit<p></p><p><br>BUT I need that the menu for this program would be like, pressing with the mouse on the “restart PC” and PC will restart…<br>Something like that: <a href=”https://web.archive.org/web/20120526055324/http://www.youtube.com/watch?v=d-gzQdUX_lg” target=”_blank”>http://www.youtube.com/watch?v=d-gz…</a><br>BUT MORE SIMPLE </p><p>I am using windows 7 32bit<br>Dont konw if that’s possible in windows7…</p><p>Thankyou for any kind of help<br></p></td>

Share

2 Answers

  1. 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:

    http://judago.webs.com/downloads.ht…

    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
    

    • 0
  2. 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

    • 0