need to speed up a batch file

Discussion in 'Software' started by red death68, Sep 18, 2009.

  1. red death68

    red death68 Command Sergeant Major

    i know iv been posting a lot in this forums for batch files but you need to ask questions to learn but i just completed a code for loading anti virus installers with option to install of my removable drive(the one iv been doing everything on for batch files)
    here is the code i just finished a few minutes ago:

    i put in the pause so i can confirm the close out the problem is how long it take to load the installers after the first one

    note on the computer im currently using it is a usb 1.0 port but it shouldnt slow it down this much

    ps:after posting i realized that my : p was making a :p so to clear up its colon p
     
  2. GermanOne

    GermanOne Guest

    At first to avoid potential errors change your code:
    Code:
    @echo off &setlocal
    :start
    set/p "cho=do you want to install advanced spyware remover free edition?(Y/N) "
    if /i "%cho%"=="Y" goto install_1
    if /i "%cho%"=="N" goto prompt_1
    goto start
    
    :install_1
    "\things that can wait\computer maintainence\anti-virus\ASRLSetup.exe"
    
    :prompt_1
    set/p "cho=do you want to install avira antivir personal free edition?(Y/N) "
    if /i "%cho%"=="Y" goto install_2
    if /i "%cho%"=="N" goto prompt_2
    goto prompt_1
    
    ... and so on.
    That means:
    -don't use spaces in labels, replace it using underlines or something else, the reason is that the batch file can use the name just until the first space
    -use quotation marks because the comparison will give an error if you press return without any input
    -use option /i to ignore upper and lowe case
    -what would happen if you would input an "a" for exemple ..., thats why better jump back in such cases

    In variable %~d0 you can find the drive of the batch file. If your batch is placed on your stick you could write
    Code:
    "%~d0\things that can wait\computer maintainence\anti-virus\ASRLSetup.exe"
    
    Indeed I can't help hurry up your files. The speed is given by your usb drive and your usb port.
     
  3. red death68

    red death68 Command Sergeant Major

    thank you for the help just one question do i countinue the code after start or after set/p? so set/p... or start...
     
  4. GermanOne

    GermanOne Guest

    It jumps to the install label if you input y and to the prompt label if you input n. Otherwise it will jump back before set /p so that the set /p - line is the first one that will be proceeded.
     
  5. red death68

    red death68 Command Sergeant Major

    so countinue the pattern with set/p...
     
  6. GermanOne

    GermanOne Guest

    Yes in case you don't enter y or n. Find out by entering something else.
     
  7. red death68

    red death68 Command Sergeant Major

    i must be doing somthing wrong i try to countinue the code and its running me in circles
     
  8. GermanOne

    GermanOne Guest

    Okay, figure out if this is running the correct way:
    Code:
    @echo off &setlocal
    :start
    set/p "cho=do you want to install advanced spyware remover free edition?(Y/N) "
    if /i "%cho%"=="Y" goto install_1
    if /i "%cho%"=="N" goto prompt_1
    goto start
    
    :install_1
    "\things that can wait\computer maintainence\anti-virus\ASRLSetup.exe"
    
    :prompt_1
    set/p "cho=do you want to install avira antivir personal free edition?(Y/N) "
    if /i "%cho%"=="Y" goto install_2
    if /i "%cho%"=="N" goto prompt_2
    goto prompt_1
    
    :install_2
    "\things that can wait\computer maintainence\anti-virus\avira_antivir_personal_en.exe"
    
    :prompt_2
    set/p "cho=do you want to install comodo internet security?(Y/N) "
    if /i "%cho%"=="Y" goto install_3
    if /i "%cho%"=="N" goto prompt_3
    goto prompt_2
    
    :install_3
    "\things that can wait\computer maintainence\anti-virus\CIS_Setup_3.11.108364.552_XP_Vista_x32.exe"
    
    :prompt_3
    set/p "cho=do you want to install malwarebytes anti-malware?(Y/N) "
    if /i "%cho%"=="Y" goto install_4
    if /i "%cho%"=="N" goto prompt_4
    goto prompt_3
    
    :install_4
    "\things that can wait\computer maintainence\anti-virus\mbam-setup.exe"
    
    :prompt_4
    set/p "cho=do you want to install Rising AntiVirus 2008?(Y/N) "
    if /i "%cho%"=="Y" goto install_5
    if /i "%cho%"=="N" goto prompt_5
    goto prompt_4
    
    :install_5
    "\things that can wait\computer maintainence\anti-virus\RPCDOC.exe"
    
    :prompt_5
    echo end of installer list, have a nice day
    pause
    
     
  9. red death68

    red death68 Command Sergeant Major

    code works perfectly a lil slow still but thats 256mb of ram for you lol
     
  10. GermanOne

    GermanOne Guest

    you should think about a new PC sometime in the next 10 or 20 years ;)
     
  11. red death68

    red death68 Command Sergeant Major

    lol ya i had somthing in the works but the guy hasnt been on forums for a while lol
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds