Help - Search - Members - Calendar
Full Version: User Menu Select and Run
MSFN Forums > Coding, Scripting and Servers > Programming (C++, Delphi, VB, etc.)

   
Google Internet Forums Unattended CD/DVD Guide
JayDogg
Ok so I want to write a batch file we can call it setup.bat that when ran asks you to chose by typing from 8 listed options lets say Option 1 is install and option 2 is move option 3 is copy and so on so if you want to run option 1 you would type install, now each of these options is going to be its own batch file that the setup.bat will start (I think call is the right term) so when you type install it starts or calls the install.bat I have made, then I need the setup.bat to pause or wait well the install.bat runs. When the install.bat is done running I then need the setup.bat to ask you if you would like to pick any other option or finish, by typing finish it will then run a cleanup.bat. I have made all the option batch files and cleanup batch file which are mostly just a few lines of code like
xcopy "C:\install.bat" "C:\Program Files\Pirates" /y
del /q/f "C:\install.bat"

which is all very simpale so I need help with the setup batch file cause Im very new to this so if any one knows how to do all that please explain in detail how thanks
Mijzelf
http://www.robvanderwoude.com/userinput.html
Yzöwl
First thing we need to know is what Operating System is this for?

You are using a bat suffix so I'd assume your using Win9x/ME but as you're new to all this that's probably not the case.

Also, if you put the individual files into a compressed archive and post them too it would certainly help fix all of the problems which may be caused by those too!
jaclaz
Maybe you could have a look at this app:
Wizard's Apprentice
http://wizapp.sourceforge.net/

Using it and the given examples it is pretty straightforward to do what you want to do, it is also a bit nicer than a "pure" .bat or .cmd file, and will work on both 9x/Me and NT/2K/XP/2003.

jaclaz
JayDogg
Im making these batch files for Windows XP sorry about that
JayDogg
Jaclaz the program Wizard's Apprentice looks really cool and if you would like to help walk me through how to make it to make what I need that would be great but if not I think that program is a bit much for me being a newbie and all
Smiley357
You might want to check out AutoIt (http://www.autoitscript.com/) Its free and very easy to use. There are examples you can view to learn from.

If you want to stick with command line and use a bat file or cmd file for XP. Then you can start out with this.
CODE
Echo   1. Install        
Echo   2. Move  
Echo   3. Copy  
Echo   4. QUIT PROGRAM                                    
Echo.
Echo.
SET /P choice=Type In Your Reply Then Press Enter ^>

IF "%choice%"=="1" (GOTO ONE)
IF "%choice%"=="2" (GOTO TWO)
IF "%choice%"=="3" (GOTO THREE)
IF "%choice%"=="4" (GOTO QUIT) ELSE (GOTO ERROR)
jaclaz
@JayDogg

As said the best example comes within the download as wainstall.bat, but you may also get this little script I wrote some time ago:
http://home.graffiti.net/jaclaz:graffiti.n...ts/VDM/vdm.html

and this one:
http://home.graffiti.net/jaclaz:graffiti.net/
http://home.graffiti.net/jaclaz:graffiti.n...X/mbrfix0.2.zip

Expecially the second one is rather straightforward and both are (well unsure.gif)) commented, you need a really basic batch commands knowledge to copy and paste bits and pieces and assemble your own routine.

The basic "choice" menu Smiley357 posted would become using Wizapp something like this:
CODE
:p
:: We set the page variable to be able to return here
:: after a Cancel request.
set page=:p
set watitle=%mytitle%
set watext=%mytext%~~Please choose one of the following
set watext=%watext%~Make your selection and press the [Next] button
set watext=%watext%~(you can use numerical keypad)
set wafile=
set walistsep=;
set wainput=^&0. Install;^&1. Move;^&2. Copy;^&3. QUIT PROGRAM
set waoutnum=
set waoutput=
set wasig=%mysig%
start /w wizapp NOBACK RB

if errorlevel 2 goto :cancel
:: no Back possible

call %wabat%
set choice=%waoutnum%
If NOT DEFINED waoutnum goto :error
IF %choice%==0 GOTO :ZERO
IF %choice%==1 GOTO :ONE
IF %choice%==2 GOTO :TWO
IF %choice%==3 GOTO :THREE



Then choices would be something like:
CODE
:ZERO
Start /w install.cmd
GOTO :EOF

:ONE
move.cmd
GOTO :EOF

:TWO
CALL copy.cmd
GOTO :EOF

:THREE
GOTO :EOF


(just examples, of course, showing different ways to invoke another batch file)

jaclaz
Google Internet Forums Unattended CD/DVD Guide
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.