| 1. |
Solve : adding a menu in a batch file? |
|
Answer» is there a way to add a menu where it says "file, edit, view" ect? I thought MS-DOS came with it? It does. Quote I am runing Win98' It does too. Quote on my home comp (and it has no Internet) Depends on whether or not you can put a copy of choice in a directory in the path. Or - learn the methods that can be used with XP. XP's command line has many capabilities that plain old dos did not. The way to do it has been covered many times here. You'll find it with a search. Quote from: gpl on December 20, 2007, 09:39:51 AM ... I doubt it would have been on a Win3.11 disk. More likely, choice.com would have been installed with the MS-DOS installation prior to installing Windows. Here is one place where choice can be downloaded: http://hp.vector.co.jp/authors/VA007219/dkclonesup/choice.html Quote But this is the 21st Century, we dont need no menus in batch, it really is the wrong language to be doing that, use an html application (.hta) for the ui if you are unable or prohibited from using a proper development environ and use batch for what its good at. While you might not absolutely need menus, there is nothing wrong with learning how it was done. Besides - you never know when you just might need to know. Quote from: WillyW on December 20, 2007, 10:23:04 AM
Oh so true !! oops, just shows how long it is since windows was an app RUNNING on top of the OS, I had forgotten about loading DOS first.... or at least assumed that the unopened pack of win 3.11 disks Ive got contained the DOS disks too. Graham Quote from: gpl on December 20, 2007, 10:37:52 AM ... or at least assumed that the unopened pack of win 3.11 disks Ive got contained the DOS disks too. That set just may. I can't remember just how they used to package it. Unopened, eh? Hang on to that. It's value might be on the way BACK up! Collector's items and all that. Well, seeign as choice is a built in command, why wouldn't my menu work? it perfectly fine for me, I use dos editor when in dos mode, and Notepad when not. I use paint pretty often to, so I put my most used programs into one batch file, and alogn with kq3 i can EXECUTE almost any program I would normally use, from my little menu. I plan on elaborating it though. maybe like this: Code: [Select]@echo off :Begin cls echo 1. Editors echo 2. Imaging echo 3. Games choice.com /c:123 (1, 2, or 3)%1 if errorlevel == 3 then goto Games if errorlevel == 2 then goto Imaging if errorlevel == 1 then goto Editors cls goto end :Games echo 1. King's Quest III echo 2. Age of Empires choice.com /c:12 (1, or 2)%2 if errorlevel == 2 then start [dir[path]] aoe.exe if errorlevel == 1 then start c:\sierra\kq3 goto end :Imaging echo 1. Paint echo 2. example choice.com /c:12 (1, or 2)%3 if errorlevel == 2 then start example if errorlevel == 1 then start mspaint goto end :Editors echo 1. Notepad echo 2. MS-DOS Editor choice.com /c:12 (1, or 2)%4 if errorlevel == 2 then edit if errorlevel == 1 then start notepad :end That works if you have more files. . this introduces Categories don't forget to go %1, %2, %3, etc. .at end of Choice commands.Another way to do a menu in batch is described here: http://www.dostips.com/DtTipsMenu.php http://www.dostips.com/DtTipsMenu2.php From the extensibility point of view a cool thing. You can add new menu items and code ANYWHERE in the batch, the smart menu loop will automatically discover and display them. Like that? |
|