Computing.Net > Forums > Programming > Progress bar batch file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Progress bar batch file

Reply to Message Icon

Name: amlife
Date: October 22, 2008 at 17:12:32 Pacific
OS: XP
CPU/Ram: 2GB
Product: HP
Comment:

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



Sponsored Link
Ads by Google

Response Number 1
Name: Razor2.3
Date: October 22, 2008 at 17:27:41 Pacific

Response Number 2
Name: amlife
Date: October 22, 2008 at 20:03:03 Pacific
Reply:

I did that my friend; Google and there are 2 examples on this site. but I didn't just get it.


0

Response Number 3
Name: Holla
Date: October 23, 2008 at 07:52:55 Pacific
Reply:

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


0

Response Number 4
Name: amlife
Date: October 23, 2008 at 10:18:10 Pacific
Reply:

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 do

do I need to remove "set /a i = i + 1" ??
which I did but it didn't work :S


0

Response Number 5
Name: Holla
Date: October 24, 2008 at 04:26:41 Pacific
Reply:

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.


0

Related Posts

See More



Response Number 6
Name: amlife
Date: October 24, 2008 at 05:53:54 Pacific
Reply:

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.


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Progress bar batch file

Progress bar in batch file www.computing.net/answers/programming/progress-bar-in-batch-file/14919.html

batch - Progress bar while copying www.computing.net/answers/programming/batch-progress-bar-while-copying-/15421.html

Batch Progress Bar! www.computing.net/answers/programming/batch-progress-bar/17167.html