Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

script to show waiting during long processes

2,026 views
Skip to first unread message

Matt Williamson

unread,
May 24, 2013, 7:10:04 AM5/24/13
to
Awhile ago, I saw a script here that showed a small spinning thing to
show activity during a long process. I believe it was written by Frank
Westlake. Does anyone have that script or maybe bookmarked the link to
it?

foxidrive

unread,
May 24, 2013, 10:01:48 AM5/24/13
to
4 progress bar doovers I snaffled.


=================================================================

: Tom Lavedas

@echo off
setlocal
set "write=<nul set/p"
%write%=Patience, please
for /l %%a in (1,1,25) do (
%write%=�
ping -n 2 127.0.0.1 > nul
)
echo. Thank you for waiting.


=================================================================


@Echo OFF
SetLocal EnableExtensions EnableDelayedExpansion

For /f %%a in ('copy /Z "%~dpf0" nul') Do set "CR=%%a"
Set "busy=|/-\"
Set /A n=0

::BUSY SPINNER
For /L %%i in (0,1,10) Do (
Set /A "n=%%i%%4"
For /L %%n in (!n! 1 !n!) Do Set /P "=Calculating !busy:~%%n,1! !CR!"<NUL:
PING -n 2 127.0.0.1 >NUL:
)
::COUNTDOWN
For /L %%i in (10,-1,1) Do (
Set /P "=Backup will begin in %%i seconds. !CR!"<NUL:
PING -n 2 127.0.0.1 >NUL:
)
::PROGRESS
For %%i in (*) Do (
Set /P "=Copying %%i !CR!"<NUL:
PING -n 2 127.0.0.1 >NUL:
)

pause


======================================================================



@echo off
:jeb
setlocal EnableDelayedExpansion
if "%~1"==":::" goto :spinnerThread

:menuLoop
<nul set /p menu=Select menu[1 or 2]=
call :GetKey
echo(
echo Pressed '!key!'
if !key!==1 call :menu1
if !key!==2 call :menu2
if !key!==2 call :menu2
goto :menuLoop

:menu1
:menu2
call :spinnerStart
rem do some work
ping localhost -n 3 > nl
call :spinnerStop
echo Finished
exit /b

:spinnerStart
del spinnerStop.tmp > nul 2>&1
start /b "" cmd /c "%~df0" :::
exit /b

:spinnerStop
echo dummy > spinnerStop.tmp
:__spinnerStop
if exist spinnerStop.tmp goto :__spinnerStop
exit /b

:spinnerThread
for /f %%a in ('copy /Z "%~f0" nul') do set "CR=%%a"
set "spinChars=\|/-"

:spinnerLoop
set /a "spinner=(spinner + 1) %% 4"
<nul set /p ".=Waiting...!spinChars:~%spinner%,1!!CR!"
ping localhost -n 2 > nul 2>&1
if not exist spinnerStop.tmp goto :spinnerLoop
del spinnerStop.tmp > nul 2>&1
echo(
exit /b

:GetKey
set "key="
for /F "usebackq delims=" %%L in (`xcopy /L /w "%~f0" "%~f0" 2^>NUL`) do (
if not defined key set "key=%%L"
)
set "key=%key:~-1%"
exit /b

==============================================================================


:: BEGIN FILE ::::::::::::::::::::::::::::::::::::::::::::::::::::
:: ProgBar.cmd
:: Frank P. Westlake, 2009-07-23
:: Demonstrates a progress bar.
:: Set variable 'size' with the number of times a loop will
:: be accomplished.
@ECHO OFF
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
Set /A size=1234, progress=0, item=0, last=0
Echo.Processing %size% items . . .
:: Save current code page for restoration at completion.
For /F "tokens=2 delims=:" %%a in ('CHCP') Do Set "CP=%%a"
:: Using code page 437 for the character '�' in the progress bar.
CHCP 437 >NUL:
:: Progress bar caption.
Echo. 10 20 30 40 50 60 70 80 90 100%%
:: 7-bit ASCII progress indicator.
::Set "indicator=___"
:: 8-bit progress indicator (�=DBh, the inverted space character).
::Set "indicator=���"
Set "indicator=���"
:: A demonstration loop.
For /L %%i in (0 1 %size%) Do (
Set /A item+=1,progress=item*10/%size%
If !last! NEQ !progress! (
Set /P "=!indicator!"<NUL:
Set /A last=progress
)
Call :DoNothing
)
:: Terminate the progress bar.
Echo.%indicator:~0,2%
:: Say bye now.
Echo.Bye.
:: Restore the computer operator's code page.
CHCP %CP% >NUL:
:: Goto :EOF.
Goto :EOF


:DoNothing
::Not doing anything yet . . .
:: Goto :EOF again.
Goto :EOF
:: END OF FILE :::::::::::::::::::::::::::::::::::::::::::::::::::







--
foxi

Frank Westlake

unread,
May 24, 2013, 12:34:41 PM5/24/13
to
2013-05-24 04:10, Matt Williamson:
> Awhile ago, I saw a script here that showed a small spinning thing to
> show activity during a long process.

There have been many posted here and I have written several. Here's one
that takes a count of items and shows the percentage of completion while
performing the task:

<https://github.com/FrankWestlake/CMD-scripts/blob/master/ProgBar.cmd>

I have modified that in the copy below so that it overwrites the
percentage line with the progress bar instead of having a percentage
caption above the bar as with the linked version above. I might replace
the above with the below, or perhaps combine the two since it is only a
demo.

The script writer needs to add some code which calculates how many items
need to be processed and set that value into the variable "size". Also
the script writer needs to replace the line "CALL :doNothing" and the
subroutine ":doNothing" with something which performs the work. The
character "Û" in the line 'Set "indicator=ÛÛÛ"' might not pass properly
through the mail system so if it doesn't appear as a solid color then
you will need to change it to hex value DH with a hex editor.


:: BEGIN FILE ::::::::::::::::::::::::::::::::::::::::::::::::::::
:: ProgBar.cmd
:: Frank P. Westlake, 2009-07-23
:: Demonstrates a progress bar.
:: Set variable 'size' with the number of times a loop will
:: be accomplished.
@ECHO OFF
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
Set /A size=1234, progress=0, item=0, last=0
For /F %%a in ('copy /Z "%~f0" NUL:') Do Set "CR=%%a"
Echo.Processing %size% items . . .
:: Save current code page for restoration at completion.
For /F "tokens=2 delims=:" %%a in ('CHCP') Do Set "CP=%%a"
:: Progress bar caption.
Set /p "=10 20 30 40 50 60 70 80 90 100%%!CR!"<NUL:
:: 7-bit ASCII progress indicator.
::Set "indicator=___"
:: 8-bit progress indicator (Û=DBh, the inverted space character).
Set "indicator=ÛÛÛ"

REM Do all the above early in the script then do the below each time you want to show progress:

:: Using code page 437 for the character 'Û' in the progress bar.
CHCP 437 >NUL:
:: A demonstration loop.
For /L %%i in (0 1 %size%) Do (
Set /A item+=1,progress=item*10/%size%
If !last! NEQ !progress! (
Set /P "=!indicator!"<NUL:
Set /A last=progress
)
Call :DoNothing
)
:: Terminate the progress bar.
Echo.%indicator:~0,2%
:: Restore the computer operator's code page.
CHCP %CP% >NUL:



:: Say bye now.
Echo.Bye.
:: Goto :EOF.
Goto :EOF


:DoNothing
::Not doing anything yet . . .
:: Goto :EOF again.
Goto :EOF
:: END OF FILE :::::::::::::::::::::::::::::::::::::::::::::::::::

Frank

Todd Vargo

unread,
May 24, 2013, 1:57:53 PM5/24/13
to
Spinner vs. progress bar:

In batch, most so-called progress indicators (especially spinners) are
merely visual delay indicators. i.e. Nag screen timers or delays to
trick the user to think something is happening in the background.

For a true progress indicator that shows actual progress activity, the
batch author needs to break the entire process down into measurable
increments, then report the progress based on the amount complete.

For example, in copying a large number of files, the author could show
copy progress broken down by the total number of files to be copied,
divided by the number of files copied so far. This requires counting the
total number of files and then calculating progress based on the number
of files copied as each file is copied. Another method would be to count
the total number of bytes to be copied and calculate progress based on
the file sizes as each file is copied. Remember however, counting the
total number of files and calculating progress adds additional time to
the process.

Note, using standard batch commands will not will not show progress for
copying a single large file because there is no intrinsic provision to
copy a file broken down in increments. A special utility (ie. vbscript
or other) would need to be written to break a large file down and
provide its own progress report.

This seems to be a worthy topic for Timo's FAQ.

--
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)

Tom Del Rosso

unread,
May 24, 2013, 2:08:05 PM5/24/13
to

foxidrive wrote:
> On 24/05/2013 21:10, Matt Williamson wrote:
> > Awhile ago, I saw a script here that showed a small spinning thing
> > to show activity during a long process. I believe it was written by
> > Frank Westlake. Does anyone have that script or maybe bookmarked
> > the link to it?
> >
>
> 4 progress bar doovers I snaffled.

This group needs a code archive.


--

Reply in group, but if emailing remove the last word.


Frank Westlake

unread,
May 24, 2013, 4:54:30 PM5/24/13
to
2013-05-24 11:08, Tom Del Rosso:
> This group needs a code archive.

Good idea. One way would be for a permanent member of the group to
establish an account at GitHub.com for alt.msdos.batch.nt. Using GitHub
we could work together on building a script and an individual can fork a
copy to his or her account and modify it for other purposes. I have
GitHub experience but I have very little computer time and much less
Internet time. If this idea is acceptable then I suggest we ask Doctor
Salmi to establish the account and get things started for us.

Frank

Frank Westlake

unread,
May 24, 2013, 5:01:49 PM5/24/13
to
2013-05-24 13:54, Frank Westlake:
> Using GitHub we could work together on building a script and an
> individual can fork a copy to his or her account and modify it for
> other purposes.

This cooperative script writing would help ensure, if feasible, that
scripts work on everything from XP onward.

Frank

phil.r...@gmail.com

unread,
May 24, 2013, 5:19:32 PM5/24/13
to
>
>
> Note, using standard batch commands will not will not show progress for
>
> copying a single large file because there is no intrinsic provision to
>
> copy a file broken down in increments. A special utility (ie. vbscript
>
> or other) would need to be written to break a large file down and
>
> provide its own progress report.
>

Hi, Todd,

For a single large file, you can just examine the number of bytes copied every few seconds by comparing current and previous (from a few seconds ago) file size information.

Here's a 'sliding bar' progress indicator. No percentages, just an indication that something is going on. You can try it without the sub-second delay provided by the call to VBSleep in line 21, but the on-screen appearance will suffer greatly. The variable 'fragment' is supposed to be four x'B2' characters.

=====begin c:\CMD\DEMO\SlidingBar.cmd ====================
01. @echo off
02. setlocal enabledelayedexpansion
03. set "fragment=²²²²"
04. set "spaces= "
05. set /a pos = -1
06. for /l %%a in (1,1,200) do call :MAIN
07. cls
08. echo/ D O N E .
09. echo/
10.
11. goto :EOF
12.
13. :MAIN
14. cls
15. set /a pos+=1
16. set "disp=!spaces:~0,%pos%!%fragment%"
17. echo/ Working . . . PLEASE WAIT.
18. echo/
19. echo/%disp%
20. if %pos% gtr 49 set /a pos = -1
21. call VBSleep 15
22. goto :EOF
=====end c:\CMD\DEMO\SlidingBar.cmd ====================
=====begin c:\CMD\UTIL\VBSleep.cmd ====================
01. @echo off & setlocal enableextensions
02. :: slightly modified version of Timo Salmi's tip #19
03. ::
04. :: syntax: ^%~n0 [milliseconds] [.]
05. ::
06. :: the default delay is 750 milliseconds
07. ::
08. :: an optional dot '.' as the second parameter will display
09. :: the time before and after the delay
10. ::
11. :: Note: all times are approximate
12.
13. echo @?@/?@-?@help@|findstr /i "@%1@">nul
14. if %errorlevel% EQU 0 (
15. call XHELP "%~f0"
16. goto :EOF
17. )
18. set "display="&set "delay="
19. if [%1] neq [] set delay=%1
20. if [%1] equ [.] set display=yes&set delay=750
21. if [%2] equ [.] set display=yes
22. if not defined delay set delay=750
23. echo WScript.Sleep %delay% > "%temp%\%~n0$$$.vbs"
24. if defined display echo/%time%
25. cscript //nologo "%temp%\%~n0$$$.vbs"
26. if defined display echo/%time%
27. for %%f in ("%temp%\%~n0$$$.vbs") do if exist %%f del %%f
28. endlocal & goto :EOF
=====end c:\CMD\UTIL\VBSleep.cmd ====================

I have only tested this in WinXP (in WinVPC under Win7). If I have time I will try it in Win7 but don't expect there to be any difference.

Phil Robyn
p r o b y n a t b e r k e l e y d o t e d u


phil.r...@gmail.com

unread,
May 24, 2013, 5:22:47 PM5/24/13
to
OOPS. Sorry about the long lines in my previous post for those offended
by long lines. Not very used to the Google Groups interface.

Todd Vargo

unread,
May 25, 2013, 1:37:17 AM5/25/13
to
Unfortunatly, the code above does not demonstrate a progress indicator
while copying a large file, which is what was quoted and commented on.
In order to function the way you suggest, the file would have to be
copied in a separate process while being monitored in the current cmd
session. I'm not saying that is a good or bad thing, I'm just saying the
code above does not do what was commented on. We both know it can be
written but the OP has not stated what sort of lengthy progress is being
measured in order to to offer an applicable example. We could post a
dozen examples and have none of them match what the OP wants to use it for.

FWIW, I have never liked wait indicators pretending to be progress
indicators. All of the batch examples I have ever seen posted use time
delays to simulate progress, but never any connection to actual progress
being performed. (ie. progress during an actual file or group of files
being copied, moved, renamed or other real batch activity) This is
largely due to OPs only asking how to display an indicator but never ask
how to apply one for a practical use.

BTW, the "call VBSleep 15" line could be replaced with a PING timer to
eliminate the need for the VBSleep.cmd batch. Just my 2 cents.

phil.r...@gmail.com

unread,
May 25, 2013, 2:46:30 AM5/25/13
to
On Friday, May 24, 2013 10:37:17 PM UTC-7, Todd Vargo wrote:
> On 5/24/2013 5:19 PM, phil.r...@gmail.com wrote:
>
> >>
>
> >>
>
> >> Note, using standard batch commands will not will not show progress for
>
> >>
>
> >> copying a single large file because there is no intrinsic provision to
>
> >>
>
> >> copy a file broken down in increments. A special utility (ie. vbscript
>
> >>
>
> >> or other) would need to be written to break a large file down and
>
> >>
>
> >> provide its own progress report.
>
> >>
>
> >
>
> > Hi, Todd,
>
> >
>
> > For a single large file, you can just examine the number of bytes
>
> > copied every few seconds by comparing current and previous (from a
>
> > few seconds ago) file size information.
>
> >
>
> > Here's a 'sliding bar' progress indicator. No percentages, just an
>
> > indication that something is going on. You can try it without the
>
> > sub-second delay provided by the call to VBSleep in line 21, but the
>
> > on-screen appearance will suffer greatly. The variable 'fragment' is
>
> > supposed to be four x'B2' characters.
>
> >
>
> > =====begin c:\CMD\DEMO\SlidingBar.cmd ====================
>
> > 01. @echo off
>
> > 02. setlocal enabledelayedexpansion
>
> > 03. set "fragment=����"
Perhaps I should have been more explicit. Never claimed that this particular
example would quantitatively show progress; rather, it shows that something
is happening, like the spinners, etc., which don't quantitatively show
progress either. My suggestion about how to monitor the copying of a large
file by monitoring the ever-increasing size of the destination file was
just a thought awaiting implementation. I'm sorry if you thought that this
particular example was offered as a solution for your 'copy-a-single-file'
case.
>
> In order to function the way you suggest, the file would have to be
>
> copied in a separate process while being monitored in the current cmd
>
> session. I'm not saying that is a good or bad thing, I'm just saying the
>
> code above does not do what was commented on. We both know it can be
>
> written but the OP has not stated what sort of lengthy progress is being
>
> measured in order to to offer an applicable example. We could post a
>
> dozen examples and have none of them match what the OP wants to use it for.
>
>
>
> FWIW, I have never liked wait indicators pretending to be progress
>
> indicators. All of the batch examples I have ever seen posted use time
>
> delays to simulate progress, but never any connection to actual progress
>
> being performed. (ie. progress during an actual file or group of files
>
> being copied, moved, renamed or other real batch activity) This is
>
> largely due to OPs only asking how to display an indicator but never ask
>
> how to apply one for a practical use.

I am in total agreement with you. I much prefer a process that actually
displays real progress in a quantitative way (see below).

>
>
>
> BTW, the "call VBSleep 15" line could be replaced with a PING timer to
>
> eliminate the need for the VBSleep.cmd batch. Just my 2 cents.

A ping timer slows the whole process down too much. A sub-second delay is
what is required to make it look halfway decent on screen.

Here's one that PRETENDS to copy a bunch of files (just for demonstration
purposes). BTW, the font I use for my console windows is Lucida Console;

=====begin h:\cmd\test\progress.cmd ====================
01. @echo off
02. setlocal enabledelayedexpansion
03. set filespec=%*
04. :: save lines and columns values for current console window
05. for /f "tokens=2" %%a in (
06. 'mode con ^| find "Lines:"'
07. ) do set lines=%%a
08. for /f "tokens=2" %%a in (
09. 'mode con ^| find "Columns:"'
10. ) do set columns=%%a
11. :: bigbar is supposed to be 50 x'DB' characters:
12. set "bigbar=██████████████████████████████████████████████████"
13. set "spaces= "
14. ::
15. :: Instead of simply displaying dots on the screen, we are
16. :: going to PRETEND to copy some files while displaying
17. :: a progress bar showing how much 'work' has been 'done'.
18. ::
19. :: First, get a list of a bunch of files that we're going
20. :: to PRETEND to copy and count how many files there are
21. :: in the list so we know how much work needs to be done
22.
23. for /f "tokens=1" %%a in (
24. 'dir /s /b /a-d "%filespec%" ^| find /v /c ""'
25. ) do set total_files=%%a
26.
27.
28. set files_copied=0
29. set /a x = total_files*10
30.
31. :: in order to make the CLS less objectionable (if that's
32. :: possible), we shrink the current console window:
33. mode con lines=13 cols=60
34.
35. for /f "tokens=*" %%a in (
36. 'dir /s /b /a-d "%filespec%"'
37. ) do call :MAIN "%%a"
38. echo Press any key to FINISH
39. pause > nul
40. :: restore the previous console lines and columns settings:
41. mode con lines=%lines% cols=%columns%
42. goto :EOF
43.
44. :MAIN
45.
46. set "filename=%~1"
47. set /a files_copied+=1
48. set y=%files_copied%000
49. set /a pct_done = y/x
50. set blength=%pct_done%
51.
52. :: force the progress bar to show SOMETHING at the very
53. :: beginning; otherwise, when the total number of files
54. :: is very large, nothing will show on the bar for a
55. :: bunch of iterations at the beginning of the process.
56. if 10 LSS %pct_done% set /a blength/=2
57.
58. set progress=!bigbar:~0,%blength%!%spaces%
59. set tdisp=%total_files%%spaces:~0,10%
60. set cdisp=%files_copied%%spaces:~0,10%
61. set ndisp=%filename%%spaces%
62. set "pdisp=%%"
63. set "pdisp= !pct_done!!pdisp!"
64. cls
65. :: ....+....1....+....2....+....3....+....4....+....5....+....6
66. echo/╔══╤══════════════════════════════════════════════════╤═══╗
67. echo/║ │%progress:~0,50%│ ║
68. echo/╟──┴──────────────────────────────────────────────────┴───║
69. echo/║ Copying %ndisp:~0,30% ║
70. echo/║ ║
71. echo/║ total: %tdisp:~0,6% copied: %cdisp:~0,6% ║
72. echo/║ ║
73. echo/║ %pdisp:~-4% complete ║
74. echo/╚═════════════════════════════════════════════════════════╝
75. :: Here is where we would copy "%filename%" x:\path\dir\ > nul
76. :: if we were actually copying the files for real
77. ::
78. :: But since we aren't actually copying any files, we need to
79. :: slow down this demo just a bit by waiting for a short time
80. :: between iterations of this subroutine. A 'ping localhost'
81. :: delay of one second would be too long and make the demo
82. :: too boring and unrealistic, so we need a subsecond delay:
83. call VBSleep 75
84. goto :EOF
=====end h:\cmd\test\progress.cmd ====================

Again, without a sub-second delay (line 83), the on-screen appearance
is not as good.

Dr J R Stockton

unread,
May 25, 2013, 3:38:32 PM5/25/13
to
In alt.msdos.batch.nt message <knok2f$5db$1...@news.albasani.net>, Fri, 24
May 2013 13:54:30, Frank Westlake <frank.w...@gmail.com> posted:

>If this idea is acceptable then I suggest we ask Doctor
>Salmi to establish the account and get things started for us.

AFAIK, there is no-one here who would nowadays be correctly addressed as
Doctor Salmi.

--
(c) John Stockton, nr London UK. replyYYWW merlyn demon co uk Turnpike 6.05.
Web <http://www.uwasa.fi/~ts/http/tsfaq.html> -> Timo Salmi: Usenet Q&A.
Web <http://www.merlyn.demon.co.uk/news-use.htm> : about usage of News.

Auric__

unread,
May 25, 2013, 7:06:05 PM5/25/13
to
Dr J R Stockton wrote:

> In alt.msdos.batch.nt message <knok2f$5db$1...@news.albasani.net>, Fri, 24
> May 2013 13:54:30, Frank Westlake <frank.w...@gmail.com> posted:
>
>>If this idea is acceptable then I suggest we ask Doctor
>>Salmi to establish the account and get things started for us.
>
> AFAIK, there is no-one here who would nowadays be correctly addressed as
> Doctor Salmi.

That's a minor quibble...

Qualifications for a professor are a doctor's degree [...]
-- from http://en.wikipedia.org/wiki/Professor#Finland

"Doctor" is probably acceptable, but yeah, I would call him either Professor
Salmi, or just Timo.

(Yes, I like to argue sometimes. Why do you ask? :-)

--
Every man is free to follow his own path, do his own thing.
Every man is a king in his own right.

phil.r...@gmail.com

unread,
May 25, 2013, 7:14:11 PM5/25/13
to
Hi, Frank,

This is a great idea. I haven't used many different
file-sharing sites, having only just begun to explore
Box and Google Drive. What is it about GitHub in
particular that recommends it as the best choice?
I know a lot of people use SourceForge for this kind
of collaboration. I'd appreciate hearing your comments
and learning from your file-sharing experience.

For example, in experimenting with Box yesterday,
I uploaded a few CMD files from my computer. Once
they were uploaded, I couldn't even edit them in the
Box environment because Box treated them as executables.
I had to redo the whole process and upload them using
names like 'whatever.cmd.TXT'. And so on. It becomes
very time-consuming. . . .

Phil Robyn
# p r o b y n a t b e r k e l e y d o t e d u #



Todd Vargo

unread,
May 25, 2013, 11:33:00 PM5/25/13
to
On 5/25/2013 2:46 AM, phil.r...@gmail.com wrote:
> On Friday, May 24, 2013 10:37:17 PM UTC-7, Todd Vargo wrote:

>> Unfortunatly, the code above does not demonstrate a progress indicator
>>
>> while copying a large file, which is what was quoted and commented on.
>
> Perhaps I should have been more explicit. Never claimed that this particular
> example would quantitatively show progress; rather, it shows that something
> is happening, like the spinners, etc., which don't quantitatively show
> progress either. My suggestion about how to monitor the copying of a large
> file by monitoring the ever-increasing size of the destination file was
> just a thought awaiting implementation. I'm sorry if you thought that this
> particular example was offered as a solution for your 'copy-a-single-file'
> case.

No, I did not think that was the case. Nor was I trying to get you to
post one either, although you did post a mighty fine example that does
demonstrate an progress indicator that performs actual work. I hope Timo
will consider adding it to his FAQ material.

Frank Westlake

unread,
May 26, 2013, 7:49:57 AM5/26/13
to
Date: Sun, 26 May 2013 09:37:57 +0000
In-Reply-To: <2f332c8b-aff7-4ebc...@googlegroups.com>
References: <d0735945-f08d-4b70...@v9g2000yqo.googlegroups.com> <opKnt.28727$JB5....@newsfe26.iad> <knoa2d$vf8$1...@dont-email.me>
<knok2f$5db$1...@news.albasani.net> <2f332c8b-aff7-4ebc...@googlegroups.com>
From: frank.w...@gmail.com
Newsgroups: alt.msdos.batch.nt
Subject: Re: script to show waiting during long processes

From phil.robyn.1:
>On Friday, May 24, 2013 1:54:30 PM UTC-7, Frank Westlake
>> 2013-05-24 11:08, Tom Del Rosso:
>> > This group needs a code archive.
>> Good idea. One way would be for a permanent member of
>> the group to establish an account at GitHub.com

>This is a great idea. I haven't used many different
>file-sharing sites, having only just begun to explore
>Box and Google Drive. What is it about GitHub in
>particular that recommends it as the best choice?
>I know a lot of people use SourceForge for this kind
>of collaboration. I'd appreciate hearing your comments
>and learning from your file-sharing experience.

I don't have any file sharing experience beyond making them available
for people to take. I did that from personal web sites when I had them
and that's all I've used GitHub for thus far. I have not used Box,
Sourceforge, or anything else of the type and I will not use anything
"Google" (they have declared that they WILL collect personal data when
we use their programs).

I suggested GitHub because it is the only collaboration site I know
anything about. My thoughts on GitHub:

- I haven't noticed any advertisements (nor any advertizements).

- It's free (no cost).

- An account is not required to take files.

- An account is required to upload, modify, or remove. This requires
software which understands the git language. For Windows there is both a
GUI application and a port of the Linux shell interface. With the latter
you could create shell scripts to do mundane work. GitHub distributes
some of these applications (bottom of https://github.com/) but the
language can be incorporated into any application.

- Anyone with a GitHub account can fork a script (copy it to their own
accounts for editing). The forked scripts can be merged into the master
but I have no experience with this feature.

- I think there can also be any number of people who, having an
account, can directly upload, modify, and delete. Any of these changes
can be reverted if the current owner choses. I have no experience with
this.

- GitHub maintains a history of changes and they can be reverted as far
back as desired. I have no experience with this either.

- GitHub retains authorship of each change. You can view who authored
which portions of scripts.

- GitHub has an internal mail system for users with accounts. This can
also be used to notify you of a variety things, such as changes and bug
reports. It can be forwarded to your Internet mail address.

- An account is required to submit bugs reports and other issues, but
for us that is probably best done here.

- I can't think of any more thoughts (am I now thoughtless?).

Frank

phil.r...@gmail.com

unread,
May 28, 2013, 12:15:10 AM5/28/13
to

Frank, you are one of the most thoughtful guys I know. You will never
be thoughtless; it's not in your nature ;-)

GitHub is geographically right in my own back yard and I haven't tried
it yet! That's what happens after you retire: you find yourself OOTL
(out of the loop). Sounds like GitHub would be perfect. The miracle is
always in the details of the magic merging of various updates from
different contributors, hopefully always under the owner's (owners'?)
control. (Faded memories of Panvalet and CVS ... (shudder).)

When you say 'scripting', does that require Linux? Or is it possible to
use CMD and/or other interpreter(s) running on Windows?

--
Phil Robyn
* p r o b y n a t b e r k e l e y d o t e d u *

Frank Westlake

unread,
May 28, 2013, 10:18:02 AM5/28/13
to
2013-05-27 21:15, phil.r...@gmail.com:
> Sounds like GitHub would be perfect. The miracle is
> always in the details of the magic merging of various updates from
> different contributors, hopefully always under the owner's (owners'?)
> control. (Faded memories of Panvalet and CVS ... (shudder).)

You might have more time then Doctor Salmi does and it appears that you already have this kind of experience so why don't you just set this up for us?
I don't think the group will join together on it until it is already there for them to use. Establish an account for yourself first to see how it
goes, then establish one for the group and figure out how to give yourself access, if possible. You can also experiment with giving me access
(FrankWestlake) but I'll only be able to get my laptop on the Internet for about an hour most days.

A free account was limited to a certain small number of repositories -- I think seven -- but I think they have decided to ignore this. It might be
useful to use separate repos to categorize scripts some way: "Networking", "Windows 8 only", etc.

> When you say 'scripting', does that require Linux? Or is it possible to
> use CMD and/or other interpreter(s) running on Windows?

When I first set up GitHub (2009?) it installed a Linux shell interface (mingw) on my system, which was Windows XP or Vista back then. It has been my
assumption that it is a scriptable shell but I haven't tried it. I think you might also be able to do much with git.exe directly but I haven't tried
that either. I only used the system to push my stuff there for others to have, and I now use the Windows GUI application for that.

Frank

Tom Del Rosso

unread,
May 28, 2013, 11:43:24 AM5/28/13
to

Frank Westlake wrote:
>
> When I first set up GitHub (2009?) it installed a Linux shell
> interface (mingw) on my system, which was Windows XP or Vista back
> then. It has been my assumption that it is a scriptable shell but I
> haven't tried it. I think you might also be able to do much with
> git.exe directly but I haven't tried that either. I only used the
> system to push my stuff there for others to have, and I now use the
> Windows GUI application for that.

If this is the same git, it has version control built in.

http://en.wikipedia.org/wiki/Git_%28software%29

Tom Del Rosso

unread,
May 28, 2013, 11:49:47 AM5/28/13
to

phil.r...@gmail.com wrote:
> When you say 'scripting', does that require Linux? Or is it possible
> to use CMD and/or other interpreter(s) running on Windows?

Batch, VBS, Python, awk, Perl, Rexx, and others, are all scripting languages
on Windows, most of which are cross-platform, although awk is native to
Unix.

Frank Westlake

unread,
May 28, 2013, 1:07:09 PM5/28/13
to
2013-05-28 08:43, Tom Del Rosso:
> If this is the same git, it has version control built in.
>
> http://en.wikipedia.org/wiki/Git_%28software%29

That is the Git that GitHub uses; written by Doctor Linus Torvalds. If Phil was referring to version control then I missed it; I am not a programmer
and have never used any versioning or collaboration system except to push changes to my own applications in my own account. My version identifier is
always the date of the last change. I recall Phil writing that he is not a programmer either but he has more not-a-programmer experience than I have.

Frank

Philip Robyn

unread,
May 28, 2013, 6:24:37 PM5/28/13
to
Hi, Frank,

With regard to time, SOMETIMES I do have 'more' time, but sometimes I don't.
I will give GitHub a whirl. Box already seems unsatisfactory to me for this
kind of work.

Your idea of dividing files up into various categories is a good one, and
opens the discussion of lucid organization, standards, and overarching goals
and principles (always very useful things to have in undertakings like this).

Your history of GitHub use might prove useful as well. In my case, I'm doing
all of my work in WinXP under WinVPC on Win7 Pro. What in particular does
the GitHub software need access to, other than the file system? It's easy to
get files in and out from WinXP under VPC, etc., but I haven't figured out
how to do the opposite, that is, to access the WinXP/WinVPC file system from the host Win7 Pro. So my questions in this regard are (1) where would you advise me to 'install' the Git software (virtual XP or host 7), and (2) is
there much functional difference between the XP and Win7 versions of the Git software?

One other general question that has been nagging me: I don't have Win8, and
I don't really know how extensive the differences are between XP, 7, and 8
with regard to batch ('CMD') programming. Since you brought up the category
of 'Win8 only', where can I get up to speed on the differences?

--
Phil Robyn

Philip Robyn

unread,
May 28, 2013, 6:37:21 PM5/28/13
to
Hi, Tom,

Thanks, I do still use Rexx somewhat (Regina)and VBS every now and then
but my favorite command interpreter of all time is Wylbur, which runs
like gangbusters under WinXP / WinVPC on Win7 (but not on Win8). I have
my Wylbur 'system' all integrated with CMD. ;-)

--
Phil Robyn

Philip Robyn

unread,
May 28, 2013, 6:49:56 PM5/28/13
to

> That is the Git that GitHub uses; written by Doctor Linus Torvalds. If Phil was referring to version control then I missed it; I am not a programmer

You not a programmer?!?! Wow! Sure fooled me!

(The version-control reference was my mention of Panvalet, a very widely used
mainframe version control product from the 1970s still prevalent today.)
>
> and have never used any versioning or collaboration system except to push changes to my own applications in my own account. My version identifier is
>
> always the date of the last change.

I don't expect that there will be such a high volume of updates and changes
that it will become a problem.

> I recall Phil writing that he is not a programmer either but he has more not-a-programmer experience than I have.
>

Technically, you are correct: ever since I retired at the end of June 2006,
I have not been a programmer. But before that, I was a programmer for the
Univ. of California at Berkeley.

--
Phil Robyn

Frank Westlake

unread,
May 31, 2013, 7:44:34 AM5/31/13
to
2013-05-28 15:24, Philip Robyn:
> I will give GitHub a whirl. Box already seems unsatisfactory to me for this
> kind of work.

GitHub might also be unsatisfactory. I looked at it some more this week
and found that it doesn't have the multiple access that I thought it
did. I thought an account owner could give other users permission to do
writes at certain levels, but I could not find any evidence of that. I
think the way it is intended to work is for a user with another account
to fork (copy) an entire repository, modify it, then mail the owner of
the repository requesting that the modifications be merged into the
original. I think that procedure is too much for our purpose. I think
mostly we just want to add complete scripts to a repository. The GitHub
procedure requires either that each of us get an account, install Git
software, learn how to fork, pull, and push, and for someone with the
account password to know how to merge and resolve any conflicts. You
might already have all that knowledge and ability but your future
replacement probably won't.

> What in particular does
> the GitHub software need access to, other than the file system?

Only the file system. The MingW shell looks only where you tell it to
look; you 'cd' to the appropriate directory then run something like

git comit -a -m "First commit"
git push orig master

The Windows GUI application will offer to scan the hard drive for '.git'
directories and offer to add those repositories to its database. You push
buttons to commit and push (sync).

> It's easy to get files in and out from WinXP under VPC, etc., but I haven't
> figured out how to do the opposite, that is, to access the WinXP/WinVPC file
> system from the host Win7 Pro. So my questions in this regard are (1) where
> would you advise me to 'install' the Git software (virtual XP or host 7), and (2) is
> there much functional difference between the XP and Win7 versions of the Git software?

(2) There is not any difference with the MingW shell interface and I
doubt that there is any functional difference between GUI applications.

(1) Considering (2), if you use GitHub for our repository, which I
recommend against, I recommend not using a virtual host at all. Just
make a directory somewhere for the GitHub account then each repo would
be a subdirectory of that.

> One other general question that has been nagging me: I don't have Win8, and
> I don't really know how extensive the differences are between XP, 7, and 8
> with regard to batch ('CMD') programming. Since you brought up the category
> of 'Win8 only', where can I get up to speed on the differences?

I think the major differences are with the set of command line programs
which are available; for example: Windows XP doesn't normally have
WMIC.EXE. There also seems to have been a very few number of problems
fixed with the behavior of CMD.EXE. I mentioned one difference between
Windows 7 and Windows 8 in this group but I don't recall what it was. I
think it was a case of CMD being fixed to function as it should have, so
it wouldn't be a problem unless you are trying to make use of
undocumented behavior.

I don't know where you can get up to speed on the differences. MicroSoft
should -- if they were a responsible business -- provide us with a chart
showing which command line programs are available in the default
configuration of each of their operating systems. I have never seen such
a thing and that suggests to me that they do not want us to succeed at
using CMD.EXE.

In summary, I don't think we should use GitHub. I think we should use
something which is only a file stash; preferably HTTP retrieval.

Do you know anything about Google Projects? I think it's SVN, but I
don't know anything about SVN.

Frank

Gabor Grothendieck

unread,
May 31, 2013, 2:00:12 PM5/31/13
to
On Friday, May 31, 2013 7:44:34 AM UTC-4, Frank Westlake wrote:
> Do you know anything about Google Projects? I think it's SVN, but I
> don't know anything about SVN.

I assume you are referring to googlecode.com. I use it regularly. It supports svn, git and hg. For any one project you have to decide which one to use. (My own projects pre-date the introduction of hg and git on googlecode so they necessarly use svn.) It supports three roles: project owners, committers and contributors. Others can view.

Recently googlecode announced that they will no longer support a Download area starting soon; however, you can download files directly from the subversion repository without having subversion on your machine and I assume that facility will continue so I am not sure that this will involve much practical restriction. (Apparently github has the same restriction.)

In addition to the repo you get a subdomain, wiki, home page and bug tracker. The content of the home page and wiki page(s) are written using a simple markup language.

For example, here are a couple of sample projects:

http://batchfiles.googlecode.com - Windows batch files for use with R
http://csvfix.googlecode.com - C++ program to process CSV files

Frank Westlake

unread,
Jun 1, 2013, 10:38:45 AM6/1/13
to
2013-05-31 11:00, Gabor Grothendieck:> On Friday, May 31, 2013 7:44:34 AM UTC-4, Frank Westlake wrote:
>> Do you know anything about Google Projects? I think it's SVN, but I
>> don't know anything about SVN.
>
> I assume you are referring to googlecode.com.

Yes, and thank you for this information.

> It supports svn, git and hg.

I assume "hg" is Mercury (Hg), for Mercurial, instead of for Harvard
Graphics.

> It supports three roles: project owners, committers and contributors.
> Others can view.

Is that a feature of googlecode or of svn and hg? GitHub doesn't have it
but A Mercurial project I watch does have it.

I participated in a googlecode group but I could not submit any code
because I would not agree to the contributor agreement. I no longer
recall specifically what I did not agree with, it might have only been a
general disagreement with being agreeable. Is the contributor agreement
required?

> Recently googlecode announced that they will no longer support a
> Download area starting soon; however, you can download files directly
> from the subversion repository without having subversion on your
> machine and I assume that facility will continue so I am not sure
> that this will involve much practical restriction. (Apparently
> github has the same restriction.)

GitHub used to allow downloads separate from the project code structure.
I discontinued all of my projects when they removed this feature, but I
later restored my CMD script files because they didn't require any
separate support files. I've since then discovered that GitHub will
accept probably any file types in the code section.


> In addition to the repo you get a subdomain, wiki, home page and bug tracker.

If we use googlecode.com the group should decide on a subdomain.

> http://batchfiles.googlecode.com - Windows batch files for use with R
> http://csvfix.googlecode.com - C++ program to process CSV files

Looks good, thanks.

What would be required for a script writer to upload a script (*.cmd) to
a project if svn is used?

Frank

Gabor Grothendieck

unread,
Jun 1, 2013, 12:56:09 PM6/1/13
to
On Saturday, June 1, 2013 10:38:45 AM UTC-4, Frank Westlake wrote:
> 2013-05-31 11:00, Gabor Grothendieck:> On Friday, May 31, 2013 7:44:34 AM UTC-4, Frank Westlake wrote:
>
> >> Do you know anything about Google Projects? I think it's SVN, but I
>
> >> don't know anything about SVN.
>
> >
>
> > I assume you are referring to googlecode.com.
>
>
>
> Yes, and thank you for this information.
>
>
>
> > It supports svn, git and hg.
>
>
>
> I assume "hg" is Mercury (Hg), for Mercurial, instead of for Harvard
>
> Graphics.

Was using the name of the command in all three cases.

>
> > It supports three roles: project owners, committers and contributors.
>
> > Others can view.
>
>
>
> Is that a feature of googlecode or of svn and hg? GitHub doesn't have it

It is a feature of googlecode.

>
> but A Mercurial project I watch does have it.
>
> I participated in a googlecode group but I could not submit any code
> because I would not agree to the contributor agreement. I no longer
> recall specifically what I did not agree with, it might have only been a
> general disagreement with being agreeable. Is the contributor agreement
> required?

Haven't tried that one but I can send you info offline so you can test it out with one of my projects.

Gabor Grothendieck

unread,
Jun 1, 2013, 1:24:39 PM6/1/13
to
On Saturday, June 1, 2013 10:38:45 AM UTC-4, Frank Westlake wrote:
> What would be required for a script writer to upload a script (*.cmd) to
> a project if svn is used?

The Source tab on the googlecode project shows the exact command to grab a checkout and that would be the first step. The following commands update your local checkout to be in sync with the repo (assuming some time has passed since the checkout), gives some status info, registers a newly created file with your checkout and performs a commit:

svn up
svn status
svn add myfile.cmd
svn ci -m "some description"

There are tons of tutorials around.

Tom Del Rosso

unread,
Jun 1, 2013, 3:11:43 PM6/1/13
to

Frank Westlake wrote:
>
> What would be required for a script writer to upload a script (*.cmd)
> to a project if svn is used?

I assume the tools aren't needed to download from such an archive, but it
would be nice if people could contribute even if they don't use any of the
tools being discussed.

I started this by observing that the group needs an archive, but what I had
in mind is less formal. Lots of small routines from many posters should be
included. Instead of having a few people with version management tools, a
few people could act like moderators who copy code from the group to the web
space. Posters could indicate in the subject that a program or routine is
tested and ask for inclusion.

Gabor Grothendieck

unread,
Jun 1, 2013, 3:34:02 PM6/1/13
to
On Saturday, June 1, 2013 3:11:43 PM UTC-4, Tom Del Rosso wrote:
> I assume the tools aren't needed to download from such an archive, but it
> would be nice if people could contribute even if they don't use any of the
> tools being discussed.
>

If this comment is with respect to googlecode then one can download individual files without having the client software but one must have the client to download the entire project or to upload.

Tom Del Rosso

unread,
Jun 1, 2013, 4:26:31 PM6/1/13
to
But scripts usually aren't "projects."

So maybe this whole thing is taking it in the wrong direction.

foxidrive

unread,
Jun 1, 2013, 4:35:15 PM6/1/13
to
On 2/06/2013 05:11, Tom Del Rosso wrote:

> I started this by observing that the group needs an archive, but what I had
> in mind is less formal. Lots of small routines from many posters should be
> included. Instead of having a few people with version management tools, a
> few people could act like moderators who copy code from the group to the web
> space. Posters could indicate in the subject that a program or routine is
> tested and ask for inclusion.

www.Dostips.com might be willing to host such a library of scripts in the forum. As forum members,
people can add threads and create a subject line to bundle scripts into - and it is what the forum is
there for, to provide dos tips and scripts. XP is listed as the dominant OS but every version of Windows
is covered since I've been there.

The admin is easy going - it's all focused on batch scripting.

If there are any questions I'd be happy to raise them with the forum admin and reply back.


--
foxi

frank.w...@gmail.com

unread,
Jun 2, 2013, 6:08:24 AM6/2/13
to
From Gabor Grothendieck :
>... I can send you info offline
>so you can test it out with one of my projects.

Thank you but I don't have enough Internet time to get
deeply involved. I normally transfer e-mail with an
Android as I pass a wireless Internet router, then I
read and write at home. I'm only trying to bring out
information for someone else to use.

Frank

frank.w...@gmail.com

unread,
Jun 2, 2013, 6:22:48 AM6/2/13
to
From Gabor Grothendieck :
> svn up
> svn status
> svn add myfile.cmd
> svn ci -m "some description"

Thanks for your time. 'svn' appears to be about as
involved as git so it might not be a good choice for us
either. I suppose it will be the same with 'hg'. I think
we should probably use something that has HTTP or FTP
uploading.

Frank

frank.w...@gmail.com

unread,
Jun 2, 2013, 6:40:56 AM6/2/13
to
From "Tom Del Rosso" :
>I started this by observing that the group needs an
>archive, but what I had
>in mind is less formal. Lots of small routines from
>many posters should be
>included. Instead of having a few people with version
>management tools, a
>few people could act like moderators who copy code from
>the group to the web
>space. Posters could indicate in the subject that a
>program or routine is
>tested and ask for inclusion.

I agree. Does anyone know where we can get some web
server space?

Frank

frank.w...@gmail.com

unread,
Jun 2, 2013, 6:45:16 AM6/2/13
to
From "Tom Del Rosso" :
>But scripts usually aren't "projects."

>So maybe this whole thing is taking it in the wrong
>direction.

Agreed. I was thinking of the script archive as a
project.

Frank

Tom Del Rosso

unread,
Jun 2, 2013, 9:57:48 AM6/2/13
to

foxidrive wrote:
>
> www.Dostips.com might be willing to host such a library of scripts in
> the forum. As forum members, people can add threads and create a
> subject line to bundle scripts into - and it is what the forum is
> there for, to provide dos tips and scripts. XP is listed as the
> dominant OS but every version of Windows is covered since I've been
> there.
>
> The admin is easy going - it's all focused on batch scripting.
>
> If there are any questions I'd be happy to raise them with the forum
> admin and reply back.

It's highly formatted, as if everything is finalized for publication. There
are screenshots, and paragraphs to describe each script that are sometimes
longer than the script. I think it should be a little simpler, like if the
OP question and the replies were saved, with a little editing.

foxidrive

unread,
Jun 2, 2013, 9:05:33 PM6/2/13
to
That is the info section of the site. The actual forum is similar in nature to a Usenet thread where
each post follows in time sequence and the previous post(s) are quoted - and there is a CODE tag that
allows batch code to appear without formatting.

See here for the main forum.

http://www.dostips.com/forum/viewforum.php?f=3



--
foxi

Tom Del Rosso

unread,
Jun 3, 2013, 5:57:36 PM6/3/13
to
Is there a file area, like Timo's site? His layout is really ideal, but I
didn't want to lay it on his shoulders.

Rather than save whole threads in a forum archive, all that really needs to
be saved is an OP question and the code.

foxidrive

unread,
Jun 3, 2013, 6:43:44 PM6/3/13
to
On 4/06/2013 07:57, Tom Del Rosso wrote:
> foxidrive wrote:
>> See here for the main forum.
>>
>> http://www.dostips.com/forum/viewforum.php?f=3
>
> Is there a file area, like Timo's site? His layout is really ideal, but I
> didn't want to lay it on his shoulders.

No, though smaller files can be encoded and saved in text blobs in a message similar to a.m.b.nt

> Rather than save whole threads in a forum archive, all that really needs to
> be saved is an OP question and the code.

That's how I saw it too, rather than archiving the Usenet group.

With a forum there is no need to designate specific people to add material as anyone can have an account
and add what they see as interesting material: though there may also be additional improvements and
comments added by the other users of the forum.


--
foxi

monnoc...@gmail.com

unread,
Mar 14, 2017, 11:46:14 AM3/14/17
to
Il giorno venerdì 24 maggio 2013 16:01:48 UTC+2, foxidrive ha scritto:
> On 24/05/2013 21:10, Matt Williamson wrote:
> > Awhile ago, I saw a script here that showed a small spinning thing to
> > show activity during a long process. I believe it was written by Frank
> > Westlake. Does anyone have that script or maybe bookmarked the link to
> > it?
> >
>
> 4 progress bar doovers I snaffled.
>
>
> =================================================================
>
> : Tom Lavedas
>
> @echo off
> setlocal
> set "write=<nul set/p"
> %write%=Patience, please
> for /l %%a in (1,1,25) do (
> %write%=�
> ping -n 2 127.0.0.1 > nul
> )
> echo. Thank you for waiting.
>
>
> =================================================================
>
>
> @Echo OFF
> SetLocal EnableExtensions EnableDelayedExpansion
>
> For /f %%a in ('copy /Z "%~dpf0" nul') Do set "CR=%%a"
> Set "busy=|/-\"
> Set /A n=0
>
> ::BUSY SPINNER
> For /L %%i in (0,1,10) Do (
> Set /A "n=%%i%%4"
> For /L %%n in (!n! 1 !n!) Do Set /P "=Calculating !busy:~%%n,1! !CR!"<NUL:
> PING -n 2 127.0.0.1 >NUL:
> )
> ::COUNTDOWN
> For /L %%i in (10,-1,1) Do (
> Set /P "=Backup will begin in %%i seconds. !CR!"<NUL:
> PING -n 2 127.0.0.1 >NUL:
> )
> ::PROGRESS
> For %%i in (*) Do (
> Set /P "=Copying %%i !CR!"<NUL:
> PING -n 2 127.0.0.1 >NUL:
> )
>
> pause
>
>
> ======================================================================
>
>
>
> @echo off
> :jeb
> setlocal EnableDelayedExpansion
> if "%~1"==":::" goto :spinnerThread
>
> :menuLoop
> <nul set /p menu=Select menu[1 or 2]=
> call :GetKey
> echo(
> echo Pressed '!key!'
> if !key!==1 call :menu1
> if !key!==2 call :menu2
> if !key!==2 call :menu2
> goto :menuLoop
>
> :menu1
> :menu2
> call :spinnerStart
> rem do some work
> ping localhost -n 3 > nl
> call :spinnerStop
> echo Finished
> exit /b
>
> :spinnerStart
> del spinnerStop.tmp > nul 2>&1
> start /b "" cmd /c "%~df0" :::
> exit /b
>
> :spinnerStop
> echo dummy > spinnerStop.tmp
> :__spinnerStop
> if exist spinnerStop.tmp goto :__spinnerStop
> exit /b
>
> :spinnerThread
> for /f %%a in ('copy /Z "%~f0" nul') do set "CR=%%a"
> set "spinChars=\|/-"
>
> :spinnerLoop
> set /a "spinner=(spinner + 1) %% 4"
> <nul set /p ".=Waiting...!spinChars:~%spinner%,1!!CR!"
> ping localhost -n 2 > nul 2>&1
> if not exist spinnerStop.tmp goto :spinnerLoop
> del spinnerStop.tmp > nul 2>&1
> echo(
> exit /b
>
> :GetKey
> set "key="
> for /F "usebackq delims=" %%L in (`xcopy /L /w "%~f0" "%~f0" 2^>NUL`) do (
> if not defined key set "key=%%L"
> )
> set "key=%key:~-1%"
> exit /b
>
> ==============================================================================
>
>
> :: BEGIN FILE ::::::::::::::::::::::::::::::::::::::::::::::::::::
> :: ProgBar.cmd
> :: Frank P. Westlake, 2009-07-23
> :: Demonstrates a progress bar.
> :: Set variable 'size' with the number of times a loop will
> :: be accomplished.
> @ECHO OFF
> SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
> Set /A size=1234, progress=0, item=0, last=0
> Echo.Processing %size% items . . .
> :: Save current code page for restoration at completion.
> For /F "tokens=2 delims=:" %%a in ('CHCP') Do Set "CP=%%a"
> :: Using code page 437 for the character '�' in the progress bar.
> CHCP 437 >NUL:
> :: Progress bar caption.
> Echo. 10 20 30 40 50 60 70 80 90 100%%
> :: 7-bit ASCII progress indicator.
> ::Set "indicator=___"
> :: 8-bit progress indicator (�=DBh, the inverted space character).
> ::Set "indicator=���"
> Set "indicator=���"
> :: A demonstration loop.
> For /L %%i in (0 1 %size%) Do (
> Set /A item+=1,progress=item*10/%size%
> If !last! NEQ !progress! (
> Set /P "=!indicator!"<NUL:
> Set /A last=progress
> )
> Call :DoNothing
> )
> :: Terminate the progress bar.
> Echo.%indicator:~0,2%
> :: Say bye now.
> Echo.Bye.
> :: Restore the computer operator's code page.
> CHCP %CP% >NUL:
> :: Goto :EOF.
> Goto :EOF
>
>
> :DoNothing
> ::Not doing anything yet . . .
> :: Goto :EOF again.
> Goto :EOF
> :: END OF FILE :::::::::::::::::::::::::::::::::::::::::::::::::::
>
>
>
>
>
>
>
> --
> foxi

Not one of these codes works. I always get an error for some weird char.
I thought it was some easy task but appearently it must be very difficult to show a progress bar in a batch file.

Zaidy036

unread,
Mar 14, 2017, 12:41:16 PM3/14/17
to
This is not a "spinner" but adds "dots" every 5 minutes with numbers on
1/4 hour. I use it to display Acronis True Image running times. Easy to
mod for other programs.

<start ATI>
TIMEOUT 60 > NUL & :: wait for TrueImage Start
SET /A "_TTT=0" & :: Number of quarter hours ATI ran
SET "_ATIs=TrueImageService.exe"
ECHO( & ECHO | SET /P "dummy=ATI Running (1/4 Hr) "
:ATI_Running
FOR /L %%t IN (5,5,15) DO (
TIMEOUT 300 > NUL
IF %%t LSS 15 ECHO | SET /P "dummy=."
)
SET /A "_TTT=%_TTT%+1"
ECHO | SET /P "dummy=%_TTT%"
TASKLIST /FI "IMAGENAME eq %_ATIs%" 2> NUL|FINDSTR /I "%_ATIs%" > NUL
IF NOT ERRORLEVEL 1 GOTO ATI_Running
<continue>

pro...@berkeley.edu

unread,
Mar 29, 2017, 6:49:11 PM3/29/17
to
On Tuesday, March 14, 2017 at 8:46:14 AM UTC-7, monnoc...@gmail.com wrote:
> Il giorno venerdì 24 maggio 2013 16:01:48 UTC+2, foxidrive ha scritto:

<<<<<<SNIP>>>>>>
>
> Not one of these codes works. I always get an error for some weird char.
> I thought it was some easy task but appearently it must be very difficult to show a progress bar in a batch file.

I didn't try any of the preceding. This works for me:

@echo off
setlocal enableextensions enabledelayedexpansion
for /f %%x in ('copy /z "%~dpf0" nul') do set "CR=%%x"
for /l %%i in (1,1,99) do set "blanks= !blanks!"
echo/|set/p = ►►► %0 - working
for /l %%a in (1,1,25) do (
for /l %%b in (1,1,1000) do call :delay
echo/|set/p = ░
)
echo/!CR!Done.!blanks!
endlocal & goto :EOF
:delay
goto :EOF

--
Phil Robyn
0 new messages