suos Posted October 10, 2007 Share Posted October 10, 2007 Hello,ik would like to make a batfile to install a progie.ik have a batfile that runs a unattended install, but ik would like to give the user the option to cancel install or go back to the menu. So that the user can choose for another program.i have make a batfile but its do not run if the user hits the "y" or "n" button. but i am stuck now, so ik hope someone can help me.i am a newbyan example is below===============================@echo off:startecho ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»echo º Main Menu ºecho ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹echo º 1. INSTALL Java 6 update 3. º echo º 2. INSTALL Real Alternative 1.60 º echo º 3. QUIT PROGRAM ºecho ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ ECHO.CHOICE /C:123if errorlevel 3 GOTO QUIT PROGRAM if errorlevel 2 GOTO Real Alternative 1.60.INSTALL if errorlevel 1 GOTO Java 6 update 3.INSTALL :Real Alternative 1.60.INSTALLecho ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»ECHO ºName: Real Alternative ºECHO ºRelease Date: Wednesday, September 12, 2007 ºECHO ºVersion: 1.60 ºECHO ºOperating Systems: Windows 95, ºECHO º Windows 98, ºECHO º Windows 98 SE, ºECHO º Windows ME, ºECHO º Windows NT, ºECHO º Windows 2000, º ECHO º XP, 2003 and Vista ºECHO ºLicense: Freeware ºecho ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼecho.echo Do you want to install Real Alternative? choice /n /c:ync Yes, No, Cancel if errorlevel c GOTO :cif errorlevel n GOTO :nif errorlevel y GOTO :y:y@realalt160.exe /verysilent /norestart /LoadInf=".\realalt.ini"goto :end:necho operation cancelledgoto :end:cgoto :start:end===============thanks a lotgreetings Ton Link to comment Share on other sites More sharing options...
net_user Posted October 10, 2007 Share Posted October 10, 2007 check out my example...modify to your needs...:MAIN_MENUtitle MAIN MENUCLSECHO ********************ECHO WHAT DO YOU WANNA DO?ECHO 1 - IPCONFIG/FLUSHDNSECHO 2 - IPCONFIG /RELEASEECHO 3 - IPCONFIG /RENEWECHO 4 - IPCONFIGECHO 5 - EXITCHOICE /C:12345IF ERRORLEVEL 5 GOTO EXITIF ERRORLEVEL 4 GOTO IPCONFIGIF ERRORLEVEL 3 GOTO RENEWIF ERRORLEVEL 2 GOTO RELEASEIF ERRORLEVEL 1 GOTO FLUSHDNS:IPCONFIGTITLE IPCONFIGIPCONFIGPAUSEGOTO MAIN_MENU:FLUSHDNSTITLE FLUSHING DNSIPCONFIG /FLUSHDNSPAUSEGOTO MAIN_MENU:RELEASETITLE RELEASING DNSIPCONFIG /RELEASEPAUSEGOTO MAIN_MENU:RENEWTITLE RENEWING YOUR IP IPCONFIG /RENEWPAUSEGOTO MAIN_MENU:EXITEXIT Link to comment Share on other sites More sharing options...
suos Posted October 10, 2007 Author Share Posted October 10, 2007 Hé net_user,thanks a lot......, its working thanks a lot.Greetings Ton Link to comment Share on other sites More sharing options...
Yzöwl Posted October 10, 2007 Share Posted October 10, 2007 Those files cannot work because this is the XP forum and the 'choice' command is not part of that OS. It is an outdated tool which is not only unsafe to use in a cmd console, it has been replaced by newer built-in commands@ECHO OFFSETLOCAL:MenuCLSSET "_="ECHO/ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»ECHO/º Main Menu ºECHO/ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹ECHO/º 1. INSTALL Java 6 update 3. ºECHO/º 2. INSTALL Real Alternative 1.60 ºECHO/º 3. QUIT PROGRAM ºECHO/ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼECHO/SET/p "_=Please choose a Menu Number [1,2,3] "IF %_% GEQ 1 IF %_% LEQ 3 GOTO Item%_%GOTO Menu:Item1CALL :Msg1ECHO/your JRE6U3 commandPING -n 6 127.0.0.1>NULGOTO Menu:Item2ECHO/ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»ECHO/º Name: Real Alternative ºECHO/º Release Date: Wednesday, September 12, 2007 ºECHO/º Version: 1.60 ºECHO/º Operating Systems: ºECHO/º Windows 95, 98, 98 SE, ME ºECHO/º Windows NT, 2000, XP, 2003 ºECHO/º Windows Vista ºECHO/º License: Freeware ºECHO/ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼECHO/SET/p "_=Do you want to install Real Alternative? [y/n] "IF /i %_:~0,1% NEQ Y GOTO MenuCALL :Msg1START "" /wait REALALT160.EXE /verysilent /norestart /LoadInf=".\realalt.ini"GOTO Menu:Msg1ECHO/Installing please wait...:Item3You will need to replace the items under the Item1 label with you actual JRE stuff. Link to comment Share on other sites More sharing options...
gunsmokingman Posted October 10, 2007 Share Posted October 10, 2007 (edited) Here is another way of doing what you want. I have tested this so there is no run time errors,you will have to add the path and swithes to install your apps. The input is not case sensitive.@Echo Off:MainMenuCLS && Color F3 && Mode 69,11Echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»Echo º Main Menu ºEcho ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹Echo º 1. INSTALL Java 6 update 3. º Echo º 2. INSTALL Real Alternative 1.60 º Echo º 3. QUIT PROGRAM ºEcho ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ Echo.SET UC=SET /P UC=Type In Your Reply Then Press Enter ^>IF /I '%UC%'=='1' GOTO MainMenuItem1IF /I '%UC%'=='2' GOTO MainMenuItem2IF /I '%UC%'=='3' GOTO QuitApp:: Catch Incorrect InputCLS && Color F4 && Mode 55,5ECHO.ECHO This was not valid ^> %UC%ping -n 5 127.0.0.1>nulGOTO MainMenu::Start Main Menu Item 1:MainMenuItem1CLS && Color 3F && Mode 69,5Echo.Echo -^> Installing Java Update 3::Uncomment Below With The Path And Switches Used::start /w "PLACE_THE_PATH_TO_THE_APP_PLACE_SWITHES_HERE"ping -n 4 127.0.0.1>nulGoTo MainMenu::Start Main Menu Item 2:MainMenuItem2CLS && Color 3F && Mode 69,23Echo.Echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»Echo º Name: Real Alternative ºEcho º Release Date: Wednesday, September 12, 2007 ºEcho º Version: 1.60 ºEcho º License: Freeware ºEcho ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼEcho.Echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»Echo º Operating Systems ºEcho º Windows 95 ºEcho º Windows 98 ºEcho º Windows 98 SE ºEcho º Windows ME ºEcho º Windows NT ºEcho º Windows 2000 º Echo º XP ºEcho º Server 2003 ºEcho º Vista ºEcho ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼEcho.Echo Type Yes or No Or QuitSET RA=SET /P RA=Type In Your Reply Then Press Enter ^>IF /I '%RA%'=='Yes' GOTO Item1IF /I '%RA%'=='No' GOTO Item2IF /I '%RA%'=='Quit' GOTO QuitApp:: Catch Incorrect InputCLS && Color F4 && Mode 55,5ECHO.ECHO This was not valid ^> %RA%ping -n 5 127.0.0.1>nulGOTO MainMenuItem2::Item 1:Item1CLS && Color 3F && Mode 69,5Echo.Echo -^> Installing Real Alternative::Uncomment Below With The Path And Switches Used::start /w "PLACE_THE_PATH_TO_THE_APP_PLACE_SWITHES_HERE"ping -n 4 127.0.0.1>nulGoTo MainMenu::Item 2:Item2GoTo MainMenu::Exit The Script:QuitAppGoto EOFExit Edited October 10, 2007 by gunsmokingman Link to comment Share on other sites More sharing options...
spacesurfer Posted October 11, 2007 Share Posted October 11, 2007 Sweet. I like the color in your script, Gunsmoking. I had been trying to add color for a long time to my command scripts. Search hi and lo on the web but the procedure evaded me. Link to comment Share on other sites More sharing options...
Yzöwl Posted October 11, 2007 Share Posted October 11, 2007 Yes, colours, (note the correct English spelling, not American), are nice at times, but as is the case with most VBScripters, they seem to write far too much in order to get the job done! GSM has added half a dozen lines of code for colour changes, but used twice as many lines as mine for the same task, and mine wasn't optimized for size either! Link to comment Share on other sites More sharing options...
suos Posted October 11, 2007 Author Share Posted October 11, 2007 Hello Guys,i have the first script change the "Y" "N" to 1,2.3 and it is working.@echo offCOLOR 0F:MAIN_MENUtitle Unattended install made by .....CLSecho ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»echo º Main Menu ºecho ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹ECHO º 1 - install QuickTime Alternative 1.90 ºECHO º 2 - install Java 6 update 3 ºECHO º 3 - install K-Lite Codec Pack 3.4.5 ºECHO º 4 - install Real Alternative 1.60 ºECHO º 5 - EXIT ºECHO ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹ECHO º Fullscreen? press ALT-ENTER ºECHO ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼCHOICE /C:12345IF ERRORLEVEL 5 GOTO EXITIF ERRORLEVEL 4 GOTO RealIF ERRORLEVEL 3 GOTO K-liteIF ERRORLEVEL 2 GOTO JavaIF ERRORLEVEL 1 GOTO QuickTime:QuickTimeTITLE INSTALL QuickTime Alternative 1.90echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»ECHO ºName: QuickTime Alternative ºECHO ºRelease Date: Friday, September 14, 2007 ºECHO ºVersion: 1.90 ºECHO ºOperating Systems: Windows 2000 ºECHO º Windows XP ºECHO º Windows 2003 ºECHO º Windows Vista ºECHO ºLicense: Freeware ºecho ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼecho.beepECHO.echo Do you want to install QuickTime Alternative 1.90? echo 1 - yesecho 2 - no (Go back to menu)ECHO.choice /c:12IF ERRORLEVEL 1 GOTO yIF ERRORLEVEL 2 GOTO n:y@quicktimealt190.exe /verysilent /norestart /LoadInf=".\qtalt.ini"PAUSEGOTO MAIN_MENU:nGOTO MAIN_MENUBut the script of Yzowl is better.And the script from gunsmokingman is the best. wow thats great. real like a pro.But.... can i handle it. i am just beginning user.i go testing.thanks to you all for the input.Greetings Ton Link to comment Share on other sites More sharing options...
suos Posted October 11, 2007 Author Share Posted October 11, 2007 Hello,i have 1 question,i put the files into a folder + the batfile. (se code below)i run the bat file,i click on nr: 1i see the mainmenuitem 1. "Name: Real Alternative"then i can see "Installing Java 6 update 3" but it wil not install.@Echo Off:MainMenutitle Unattended installCLS && Color F3 && Mode 69,11Echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»Echo º Main Menu ºEcho ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹Echo º 1. install Java 6 update 3. º Echo º 2. install Real Alternative 1.60 ºEcho º 3. install QuickTime Alternative 1.90 ºEcho º 4. QUIT PROGRAM ºEcho ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ Echo.SET UC=SET /P UC=Type In Your Reply Then Press Enter ^>IF /I '%UC%'=='1' GOTO MainMenuItem1IF /I '%UC%'=='2' GOTO MainMenuItem2IF /I '%UC%'=='3' GOTO MainMenuItem3IF /I '%UC%'=='4' GOTO QuitApp:: Catch Incorrect InputCLS && Color F4 && Mode 55,5ECHO.ECHO This was not valid ^> %UC%ping -n 5 127.0.0.1>nulGOTO MainMenu::Start Main Menu Item 1:MainMenuItem1CLS && Color 3F && Mode 69,23Echo.Echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»Echo º Name: Real Alternative ºEcho º Release Date: Wednesday, 12 September, 2007 ºEcho º Version: 1.60 ºEcho º License: Freeware ºEcho ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼEcho.Echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»Echo º Operating Systems ºEcho ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹Echo º Windows 95 ºEcho º Windows 98 ºEcho º Windows 98 SE ºEcho º Windows ME ºEcho º Windows NT ºEcho º Windows 2000 º Echo º Windows XP ºEcho º Windows Vista ºEcho º Server 2003 ºEcho ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼEcho.Echo Type Yes or No Or QuitSET RA=SET /P RA=Type In Your Reply Then Press Enter ^>IF /I '%RA%'=='Yes' GOTO Item1IF /I '%RA%'=='No' GOTO Item0IF /I '%RA%'=='Quit' GOTO QuitApp:: Catch Incorrect InputCLS && Color F4 && Mode 55,5ECHO.ECHO This was not valid ^> %RA%ping -n 5 127.0.0.1>nulGOTO MainMenuItem1::Item 1:Item1CLS && Color 3F && Mode 69,5Echo.Echo -^> Installing Java 6 update 3::Uncomment Below With The Path And Switches Used::start /w "jre-6u3-windows-i586-p-s.exe /qb-! Reboot=ReallySuppress Reboot=Suppress /norestart /passive /quiet IEXPLORER=1 MOZILLA=1 JAVAUPDATE=0 WEBSTARTICON=0 SYSTRAY=0""ping -n 4 127.0.0.1>nulGoTo MainMenu::Item 0:Item0GoTo MainMenu::Exit The Script:QuitAppGoto EOFExitcan you help me ? Link to comment Share on other sites More sharing options...
Arie Posted October 11, 2007 Share Posted October 11, 2007 Did you uncomment the command as suggested in the code which you posted yourself?I have the impression that you don't know enough about batch to make scripts of this complexity, so I would suggest making simple scripts first, instead of trying things the hard way straight from the start. Link to comment Share on other sites More sharing options...
gunsmokingman Posted October 11, 2007 Share Posted October 11, 2007 Change This::Uncomment Below With The Path And Switches Used::start /wTo This::Uncomment Below With The Path And Switches Usedstart /w Link to comment Share on other sites More sharing options...
suos Posted October 12, 2007 Author Share Posted October 12, 2007 Thanks gunsmokingman,itsworking now. now iam going to build it up.this toppic can be closed.Greetings Ton Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now