Is there a special echo-command that can do a progressbar?
I mean print a '.' without a linebreak? (like in unix)
I'm using winXP.
Progressbar?
-
- Posts: 32
- Joined: Mon Jul 23, 2007 5:37 am
Re: Progressbar?
[quote="jasell"]Is there a special echo-command that can do a progressbar?
I mean print a '.' without a linebreak? (like in unix)
I'm using winXP.[/quote]
Try this;
::+===========================================+::
::+==============[ Progress Meter ]=============+
::| 2007_01_10 by rholt |
::| core2quad@rogers.com |
::| This subroutine displays a progress meter in |
::| the titlebar of the current CMD window. |
::| |
::| Input: %1 must contain the current progress |
::| (0-100) |
::| Return: None |
::| |
::| Calculate the number of vertical bars then |
::| spaces based on the percentage value passed |
::+======================================+
:ProgressMeter
SETLOCAL ENABLEDELAYEDEXPANSION
SET ProgressPercent=%1
SET /A NumBars=%ProgressPercent%/2
SET /A NumSpaces=50-%NumBars%
::+=============================+
::| Clear the progress meter image |
::+=============================+
SET Meter=
::+==========================+
::| Build the meter image using vertical bars |
::| followed by trailing spaces |
::| Note there is a trailing space at the end |
::| of the second line below |
::+==========================+
@FOR /L %%a IN (%NumBars%,-1,1) DO (SET Meter=!Meter!I)
@FOR /L %%a IN (%NumSpaces%,-1,1) DO (SET Meter=!Meter!)
::+==========================+
::| Display the progress meter in the title bar |
::| and return to the main program |
::+==========================+
TITLE Progress: [%Meter%] %ProgressPercent%%%
ENDLOCAL
GOTO :EOF
::+===+
::| EOF |
::+===+
I mean print a '.' without a linebreak? (like in unix)
I'm using winXP.[/quote]
Try this;
::+===========================================+::
::+==============[ Progress Meter ]=============+
::| 2007_01_10 by rholt |
::| core2quad@rogers.com |
::| This subroutine displays a progress meter in |
::| the titlebar of the current CMD window. |
::| |
::| Input: %1 must contain the current progress |
::| (0-100) |
::| Return: None |
::| |
::| Calculate the number of vertical bars then |
::| spaces based on the percentage value passed |
::+======================================+
:ProgressMeter
SETLOCAL ENABLEDELAYEDEXPANSION
SET ProgressPercent=%1
SET /A NumBars=%ProgressPercent%/2
SET /A NumSpaces=50-%NumBars%
::+=============================+
::| Clear the progress meter image |
::+=============================+
SET Meter=
::+==========================+
::| Build the meter image using vertical bars |
::| followed by trailing spaces |
::| Note there is a trailing space at the end |
::| of the second line below |
::+==========================+
@FOR /L %%a IN (%NumBars%,-1,1) DO (SET Meter=!Meter!I)
@FOR /L %%a IN (%NumSpaces%,-1,1) DO (SET Meter=!Meter!)
::+==========================+
::| Display the progress meter in the title bar |
::| and return to the main program |
::+==========================+
TITLE Progress: [%Meter%] %ProgressPercent%%%
ENDLOCAL
GOTO :EOF
::+===+
::| EOF |
::+===+
-
- Posts: 32
- Joined: Mon Jul 23, 2007 5:37 am
Re: Progressbar?
jasell wrote:Is there a special echo-command that can do a progressbar?
I mean print a '.' without a linebreak? (like in unix)
I'm using winXP.
Or This
:: __________________________________________________________________
::
:: Batch File: propy.cmd
:: Author: Frank-Peter Schultze
::
:: Updates: http://www.fpschultze.de/
:: Enhancement Req.
:: And Bug Reports: support@fpschultze.de
::
:: Built/Tested On: Windows XP
:: Requirements:
::
:: Purpose: Copy a file showing a progress bar
::
:: Syntax: propy's syntax corresponds to Windows XP's COPY command.
::
:: State Changes:
::
:: Assumptions And
:: Limitations:
::
:: Last Update: 2005-09-19
:: __________________________________________________________________
::
@Echo Off
If %2!==! (
Echo Copy a file showing a progress bar.
Echo.
Echo %~n0 source target [/copyoptions]
Echo.
Echo source The file^(s^) to be copied.
Echo target The copy destination.
Echo copyoptions Correspond to Windows XP's COPY command options.
Goto :EOF)
SetLocal
::Set flag file
Set propy.FlagFile=%TEMP%\%RANDOM%.tmp
::Set default progress bar character
Set propy.ProgressBarChar=*
::Set default progress bar intervall (seconds)
Set propy.ProgressBarWait=.05
If Exist %propy.FlagFile% Del %propy.Flagfile%
Start /Min Copy %* ^& Echo. ^> %propy.Flagfile% ^& Exit
(Set /P i=Copying %1) < NUL
Set /A propy.ProgressBarWait += 1
:Loop
If Not Exist %propy.Flagfile% (
(Set /P i=%propy.ProgressBarChar%) < NUL
Ping -n %propy.ProgressBarWait% 127.0.0.1 > NUL
Goto Loop)
Del %propy.FlagFile%
EndLocal
-
- Posts: 6
- Joined: Tue May 06, 2008 8:38 pm