Progress Bar

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
jem00
Posts: 2
Joined: 16 Jun 2008 08:20

Progress Bar

#1 Post by jem00 » 16 Jun 2008 08:25

I have looked everywhere...at least I think so....online, and I can't find anything on progress bars in batch. Is it possible?

I have a little backup up script that runs and it is quite visually boring and I since there are quite a number of files that are being backed up i have no sense as to when they are going to finish. So a progress bar in this situation would be quite useful.

Any help would be greatly appreciated,

Jem00

Thebetr1
Posts: 12
Joined: 30 Jun 2008 02:50
Location: My computer
Contact:

Loader.cmd

#2 Post by Thebetr1 » 30 Jun 2008 03:06

Here's one that me and dgmakers made for fun.

i dont think its really what your looking for but if its multiple commands you can use this

Code: Select all

@echo off
title LOADER
set load=echo   Loading a delay...
echo wscript.sleep 1000 > wait.vbs
set wait=wscript.exe wait.vbs
%load%
echo                        5%%%
%wait%
cls
%load%
echo                      10%%%
%wait%
cls
%load%
echo                     15%%%
%wait%
cls
%load%
echo                    20%%%
%wait%
cls
%load%
echo                   25%%%
%wait%
cls
%load%
echo                  30%%%
%wait%
cls
%load%
echo                 35%%%
%wait%
cls
%load%
echo                40%%%
%wait%
cls
%load%
echo               45%%%
%wait%
cls
%load%
echo              50%%%
%wait%
cls
%load%
echo             55%%%
%wait%
cls
%load%
echo            60%%%
%wait%
cls
%load%
echo           65%%%
%wait%
cls
%load%
echo          70%%%
%wait%
cls
%load%
echo         75%%%
%wait%
cls
%load%
echo        80%%%
%wait%
cls
%load%
echo       85%%%
%wait%
cls
%load%
echo      90%%%
%wait%
cls
%load%
echo     95%%%
%wait%
cls
%load%
echo   100%%%
echo.
echo Completed Loading!
pause
exit

DGMakers
Posts: 13
Joined: 30 Jun 2008 04:28

#3 Post by DGMakers » 30 Jun 2008 04:41

this is an updated version thebetr1 and i just made together:

Code: Select all

@echo off
title LOADER
set load=echo   Loading a delay...
echo wscript.sleep 1000 > wait.vbs
set wait=wscript.exe wait.vbs
set /a amount=5

:loop
%load%
call:load %amount%
%wait%
cls
set /a amount=%amount%+5
if not '%amount%'=='100' goto loop

echo.
echo Completed Loading!
pause
exit

:load
set /a no=%~1
set /a gl=%no%/5
set graphic=
:loop1
set graphic=%graphic%
set /a gl=%gl%-1
if not '%gl%'=='0' goto loop1
echo %no%%%  %graphic%
exit /b

DosItHelp
Expert
Posts: 239
Joined: 18 Feb 2006 19:54

#4 Post by DosItHelp » 03 Jul 2008 23:03

jem00,

Here an approach using the functions :initProgress and :doProgress.
It shows the progress in the window title. You can minimize the window and follow the progress in the task bar:

Code: Select all

@ECHO OFF
set "max=11"
call :initProgress %max% "Window Title: [PPP]"
for /l %%N in (1,1,%max%) do (
    ping -n 2 -w 1 127.0.0.1>NUL
    call:doProgress
)
GOTO:EOF

rem -- function go here --


See complete example batch file:
http://www.dostips.com/DtCodeBatchFiles.php#Batch_Progress

Functions:
http://www.dostips.com/DtCodeCmdLib.php#Functions_doProgress
http://www.dostips.com/DtCodeCmdLib.php#Functions_initProgress

DosItHelp? :wink:

Post Reply