Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hello doing silent install for an application, please advise on how to create progress bar will tell use the status of the installation.
Thank you

: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--
Holla.

Hello thanks for your help, where do I need
to place my line ?you mentioned in that comment that it should
be in the next line.:replace the next line by the operation you
want to dodo I need to remove "set /a i = i + 1" ??
which I did but it didn't work :S

Sorry, mixed up while cleaning up the script.
You have to replace the ping command...
But if you only replace the ping command by your command, it will execute that command 100 times. Hope that is not what you want.
I would guess that you have to take the other approach, that is call :DisplayProgressBar 5
Do something
call :DisplayProgressBar 10
Do something else
call :DisplayProgressBar 25
Do something else 2
call :DisplayProgressBar 55
...
...
...and so on. For this, from this script, you only need the DisplayProgressBar routine, that is the last five lines.
(BTW, I found this approach of set /p from this board only, I forgot the author, sorry.)Updated script:
@echo off
setlocal enabledelayedexpansion
set i=1
(Set /P j=Executing) < NUL
:start
call :DisplayProgressBar %i%
:replace the next line by the operation you want to do
ping -n 1 127.0.0.1 > NUL
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--
Holla.

I have arranged to have something acceptable, as it will kill waiting period by having number going across the screen. It is cool; the program I want to install will take less that a min to have it installed on client's PC's.
again .. Thanks very much for your assistances.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |