1.

Solve : batch counter?

Answer»

I MIGHT need some help on a batch thing i'm working on. I need a COUNTER that goes from 1% to 100%, with variables that I can EASILY change the values with. Can someone just post the code here, and tell me where I can play around with the variables such as speed and LENGTH?

ty  This progress bar is pretty neat: miskox is the Author

Code: [Select]::miskox
::Dostips: Re: Counting records
::cnt_all is the number of records (INCREASE this number if your computer is too fast).
echo off
cls
call :createbinvalue 218
call :createbinvalue 196
call :createbinvalue 191
call :createbinvalue 179
call :createbinvalue 192
call :createbinvalue 217
call :createbinvalue 219

set spaces=                                                                                &rem
set fillr13=%chr219%%chr219%%chr219%%chr219%%chr219%%chr219%%chr219%%chr219%%chr219%%chr219%%chr219%%chr219%%chr219%
set fillr=%fillr13%%fillr13%%fillr13%%fillr13%%fillr13%%fillr13%
cls
set /a cnt=0
set /a cnt_all=11111
set /a old_percent=-1

:00
set /a cnt=cnt+1
set /a percent=100 * cnt / cnt_all


if not %percent%==%old_percent% set old_percent=%percent%&&call :create_progress_bar %percent%
if %cnt%==%cnt_all% goto :EOF
goto :00

:create_progress_bar

set /a proc=(77 * %1 + 22 ) / 100
title %1 %%

call set strng1=%%fillr:~0,%proc%%%
set strng2=%strng1%%spaces%
set strng3=%strng2:~0,77%

set lines=%chr196%%chr196%%chr196%%chr196%%chr196%%chr196%%chr196%%chr196%%chr196%%chr196%%chr196%%chr196%%chr196%
set line0=0 %%                                 50 %%                                 100 %%&rem
set line1=%chr218%%lines%%lines%%lines%%lines%%lines%%chr196%%chr196%%chr196%%chr196%%chr196%%chr196%%chr196%%chr196%%chr196%%chr196%%chr196%%chr196%%chr191%
set line2=%chr179%%strng3%%chr179%
set line3=%chr192%%lines%%lines%%lines%%lines%%lines%%chr196%%chr196%%chr196%%chr196%%chr196%%chr196%%chr196%%chr196%%chr196%%chr196%%chr196%%chr196%%chr217%

cls
echo %line0%
echo %line1%
echo %line2%
echo %line3%

goto :eof


:createbinvalue
set par1=%1
type nul > t.tmp
makecab /d compress=off /d reserveperdatablocksize=26 /d reserveperfoldersize=%par1% t.tmp %par1%.chr > nul
type %par1%.chr | ( (for /l %%N in (1,1,38) do pause)>nul & findstr "^" > temp.tmp )
>nul copy /y temp.tmp /a %par1%.chr /b
del t.tmp temp.tmp
for /F "delims=" %%a in (%par1%.chr) do set "chr%par1%=%%a"
del %par1%.chr
goto :EOF
thank you! that was great and the instructions were clear



Discussion

No Comment Found