Announcement

Collapse
No announcement yet.

Progress bar with my batch file

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Progress bar with my batch file

    Hello trying to install application called "Logmein", simple remote control software to support out of office users.

    The application I have supports silent install, and it works great.

    it just takes about 1- 2 min to get installed, I created a batch file will allow me to install the app here is a copy.

    @echo off
    echo.
    echo ++++++++++++++++++++++++++++++++++++
    echo Installing Remote control software
    echo ++++++++++++++++++++++++++++++++++++
    echo.
    echo Please stand by .......
    logmein.msi /quiet USERPASSWORD=pcpassword USERVERIFYPWD=pcpassword [email protected] USERWEBPASSWORD=XXXXXXXX LicenseType=free
    if errorlevel 0 echo Installation completed successfully.
    if errorlevel 1 echo Installation failed.
    echo.
    pause

    Note "XXXX" is my companies email & Password.

    I was was wondering if someone can help me developing a very simple progress bar will just inform user that the installation is currenly running.


    Thank you in advance

  • #2
    Re: Progress bar with my batch file

    As it's an MSI, why not deploy it using a GPO? That way, the message "Installing Managed Software <packagename>" will appear on the screen and the login dialog will not appear until it's complete.
    Gareth Howells

    BSc (Hons), MBCS, MCP, MCDST, ICCE

    Any advice is given in good faith and without warranty.

    Please give reputation points if somebody has helped you.

    "For by now I could have stretched out my hand and struck you and your people with a plague that would have wiped you off the Earth." (Exodus 9:15) - I could kill you with my thumb.

    "Everything that lives and moves will be food for you." (Genesis 9:3) - For every animal you don't eat, I'm going to eat three.

    Comment


    • #3
      Re: Progress bar with my batch file

      The thing as mentioned is that, I will need to have this application only for remote users when they request support only.

      some of them are sales people, who actually not part of our domain.

      however I was able to get this code; form this link

      Moderator Edit: "changed [quote]-tag to [code]-tags 'round the code
      Code:
      :Hope this helps. 
      :It echos "......" as the operation progresses.
      :And also prints percent completed in the title bar.
      :It executes the ping command 100 times in a loop.
      :You have to replace the ping command with your own command/silent operations.
      :First create a batch file with the below content and see whether the output is what you want. Prolly this can be grown into what you want.
      :For ex, if you have 20 files to copy, you can
      :call :DisplayProgressBar 5
      :Copy first file
      :call :DisplayProgressBar 10
      :copy second file
      :call :DisplayProgressBar 15
      :copy third file.
      :.. and so on.
      :It screws up the original Title though. 
      :I dont know how to read the old title and restore it.
      :Tested on cmd.exe on Vista only.
      @echo off
      setlocal enabledelayedexpansion
      set i=1
      (Set /P j=Executing) < NUL
      :start
      call :DisplayProgressBar %i%
      ping -n 1 127.0.0.1 > NUL
      :replace the next line by the operation you want to do
      set /a i = i + 1
      if /i %i% leq 100 goto start
      (Set /P j=Done) < NUL
      goto :EOF
      :DisplayProgressBar 
      (Set /P j=.) < NUL
      title %1%% Completed
      exit /b
      endlocal
      which I manged to make something acceptable, as it will kinda trick the user, by having numbers going accross; and it will at least let him know that the application is acutaly getting installed not freezing up.
      Last edited by Rems; 24th October 2008, 14:46.

      Comment


      • #4
        Re: Progress bar with my batch file

        Originally posted by amlife View Post
        The thing as mentioned is that, I will need to have this application only for remote users when they request support only
        I don't see that mentioned in your original post?

        Anyway, glad you got something working.
        Gareth Howells

        BSc (Hons), MBCS, MCP, MCDST, ICCE

        Any advice is given in good faith and without warranty.

        Please give reputation points if somebody has helped you.

        "For by now I could have stretched out my hand and struck you and your people with a plague that would have wiped you off the Earth." (Exodus 9:15) - I could kill you with my thumb.

        "Everything that lives and moves will be food for you." (Genesis 9:3) - For every animal you don't eat, I'm going to eat three.

        Comment


        • #5
          Re: Progress bar with my batch file

          Originally posted by amlife View Post
          however I was able to get this code; form this link
          Note that the author of this script has posted an "Updated script:" further down in that thread!
          Still I cannot see how this script will help you. What I see it is going to do is try to launch the same msi file a hunded times . When the installation is finished before the loop reached the 100%, the same installation starts all over, and this will repeat again and again.

          IMHO For a single MSI this would be a better batch:
          Code:
          ::# install MSI ( helpnet.acresso.com/robo/projects/HelpLibDevStudio9/IHelpCmdLineMSI.htm )
          
          @echo off
          setLocal
          :: local variable %percent% is reserved!
          
          :: job launch
          Set "sProc=msiexec.exe"
          start ""/Min "%windir%\system32\%sProc%" /I logmein.msi /quiet USERPASSWORD=pcpassword USERVERIFYPWD=pcpassword [email protected]
          call :DisplayProgressBar %sProc% 3
          
          :End of Batch
          
          
          goto:EOF --------------------
          :DisplayProgressBar SUBROUTINE
          If not defined percent (
             setlocal
             echo.&echo/    * DO NOT CLOSE THIS WINDOW *&echo.
             Set "wait=ping 127.0.0.1 -n"
             Set "monitoring=%1"
             Set /a n = %2
             set /a percent = 0
             <nul (Set /P j=Installing)
           ) Else ( <nul (Set /P j=.) )
          >nul 2>&1 (
             title %percent% %%  Completed
             If %n% NEQ 1 (
                For /f %%# in (
                  'tasklist.exe ^| find /i /c "%monitoring%"'
                ) Do if NOT %%# GTR 0 Set /a n = 1
             )
          )
          >nul (%wait% %n%) & set /a percent = percent + 1
          If %percent% LEQ 100 (
             call:DisplayProgressBar
           ) Else (
           title Done
           <nul (Set /P j=) & echo/100%% Completed
           >nul (%wait% 2)
           EndLocal
          )
          goto:EOF --------------------
          On the line call :DisplayProgressBar %sProc% 3 , where 3 is the times to ping (which actually is the loop timer here), this will be processed a 100 times (loop count). A value 3 is about 3.5 minutes, a value 2 is about 2 minutes. a value 4 is about 5,5 minutes. Choose a value what is a little bit longer that the actual time the installation takes so the proccess event monitor (using tasklist.exe) is able to detect when the installation is done then the progress indicator will be speed up to finish the bar with 100% in a shorted time.

          \Rems

          This posting is provided "AS IS" with no warranties, and confers no rights.

          __________________

          ** Remember to give credit where credit's due **
          and leave Reputation Points for meaningful posts

          Comment

          Working...
          X