Page 1 of 1

Progress Bar

Posted: 16 Jun 2008 08:25
by jem00
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

Loader.cmd

Posted: 30 Jun 2008 03:06
by Thebetr1
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

Posted: 30 Jun 2008 04:41
by DGMakers
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

Posted: 03 Jul 2008 23:03
by DosItHelp
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: