Computer Hope

Microsoft => Microsoft DOS => Topic started by: Toyman on October 24, 2017, 10:00:00 AM

Title: INSERT FLASHING OR REPEATING LINE IN FILE
Post by: Toyman on October 24, 2017, 10:00:00 AM
I'm batching a series of 'Call' commands to back up critical files to multiple devices (external drives, etc) and would like to display a line saying ". . . working . . ." that repeats or flashes until a called program completes.  My users complain that because the screen shows nothing during lengthy file-backups, they're not sure anything's happening.

Using FOR has been unsuccessful I'm guessing because my use of syntax/switches is wrong.

Thoughts? 

Toyman

Title: Re: INSERT FLASHING OR REPEATING LINE IN FILE
Post by: Sidewinder on October 27, 2017, 06:09:26 AM
Just a demo you may find helpful.

Code: [Select]
@echo off
setlocal enabledelayedexpansion

for /f %%a in ('copy /z "%~dpf0" nul') do set "cr=%%a"
set "busy=|/-\"
set /a n=0

::spinner
  for /l %%i in (0,1,10) do (
    set /a "n=%%i%%4"
    for /l %%n in (!n! 1 !n!) do set /p "=In Progress !busy:~%%n,1! !cr!"<nul:
    ping -n 2 127.0.0.1 >nul:
)

Good luck.  8)
Title: Re: INSERT FLASHING OR REPEATING LINE IN FILE
Post by: Toyman on November 03, 2017, 09:11:54 AM
Thanks, Sidewinder.

The segment (your inserted code) had to time out before continuing to the 'call' command.  Since the called program runs in the background, I'm not there yet.  Still have the blank screen.

I think invoking ANSI.SYS and piping the ESC code to it from the Call line might work.  ESC[5m = blinking text.

I'm not having luck with that - yet.  But your answer prompted a search in the forum where I found a section about using ANSI.SYS.  My education continues.

I appreciate your effort.

Toyman
Title: Re: INSERT FLASHING OR REPEATING LINE IN FILE
Post by: DaveLembke on November 03, 2017, 06:37:26 PM
Wanted to say ... "Welcome Back Sidewinder" ... been a while since I saw you here  8)
Title: Re: INSERT FLASHING OR REPEATING LINE IN FILE
Post by: patio on November 03, 2017, 06:43:07 PM
Been a while...i agree   Welcome back