Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Mar 2009
    Location
    Somewhere Over the Rainbow
    Posts
    232
    Thanks
    0
    Thanked 1 Time in 1 Post
    Hello,

    I have made a batch file to open the install file of a list of programs. Here is an example of how it looks when it runs.

    Install program 1?
    Press enter for yes. Press any key then enter to skip.

    If you press enter it will open the install file and then after you close the install my batch will continue to the next question.
    If you skip then the my batch will just go to the next question.

    It has been working great, however I would like to add an option to install all the programs one after another without any questions asked.
    In other words like an unattended install option.

    What is the simplest way to do this?

    Thanks
    Time can fix anything.....even a broken clock. - Handy Andy

  2. #2
    Super Moderator BATcher's Avatar
    Join Date
    Feb 2008
    Location
    A cultural area in SW England
    Posts
    3,413
    Thanks
    33
    Thanked 195 Times in 175 Posts
    I'm not too sure I understand what the problem is.

    If the installs work correctly when you ask whether or not the user wants to do each one, can't you simply remove the question and answer processing?

    If you posted some examples using the [ code]your BATch file here[ /code] tags (omitting the blank after each left-square-bracket), I might be able to see what you're up to!
    BATcher

    Time prevents everything happening all at once...

  3. #3
    WS Lounge VIP
    Join Date
    Dec 2009
    Location
    Earth
    Posts
    8,168
    Thanks
    47
    Thanked 978 Times in 908 Posts
    I use "set /p" to ask questions in batch files. Then you can use IF statements to jump to the required label, or use CALL to call the labels as sub-routines. Using CALL allows you to chain your commands.

    cheers, Paul

  4. #4
    Lounger
    Join Date
    Apr 2002
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I've done a lot of batch programming (years ago now...) and found the most reliable method is the one outlined on this page:
    http://www.robvanderwoude.com/bht.php

    Scroll down to the "...ask and receive user input:" section.

    Another example:
    http://www.computerhope.com/batch.htm

    Good Luck

  5. #5
    Bronze Lounger DrWho's Avatar
    Join Date
    Dec 2009
    Location
    Central Florida
    Posts
    1,501
    Thanks
    30
    Thanked 205 Times in 163 Posts
    When I started writing batch files, back in DOS 2.0, there were no choices or keyboard entries included in the DOS batch language of the day.

    I found it very easy to write a very simple batch program that printed a menu.txt file on the screen with numbered choices to perform different functions.
    Then, for each number on the menu, I write a little batch file to do that particular job.
    When a job is done, the batch file that started it, takes you back to the original menu, so you can run another job, on and on.

    Here is the menu from my Windows ME Utilities floppy disk.

    Main Menu, Windows ME Utilities

    1. Fdisk (setup new hard drive)

    2. Fdisk Make New Boot Record

    3. Format drive C: 3A. Format drive D:

    4. Scandisk C: ( /autofix )

    5. Scandisk All Drives ( /all /autofix )

    6. Run "Scanreg /restore" (restores an older version of the Registry)

    7. Run Low LEVEL Format on drive C: (total drive erase)

    8. Run HOOVER.bat (deletes 98, ME junk files)

    9. Remove "C:\_Restore\*.*" in Windows ME.

    Type your choice at the DOS prompt and press ENTER.
    __________________________________________________ ____________


    That technique has served me well for almost 30 years now.

    The 8.bat program looks like this:

    @Echo off
    cls
    call hoover.bat
    menu


    Cheers Mate!
    The Doctor
    Experience is truly the best teacher.

    Backup! Backup! Backup! GHOST Rocks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •