I have a batch file that is coping directories from a network path to another network path and in most cases I am coping about 300 files which can take a good 10 minutes. What I want to do is have something display on the screen that says Working . a few moments later Working .. and a few moments later Working ... that then maybe resets after 10 . or something. I have come across some bits of code but not really what I am looking for.
Excerpt of my current code ...
Goto :Xcopy1
:Xcopy1
rem Pause & Echo Check folder structure for correct number of files & Rem ECHO Type 'D' if asked for directory or file? & sleep 3
Echo Working ...
Echo.>>%log%
Echo **********XCOPY START %Time%**********>>%log%
xcopy %DevelopHost%\bank\T%CN%\Parms %ProductionSrv%\bank\T%CN%\Parms /Y>>%log%
Rem Xcopy Parms and Forms from IRDTEMPLATE
cls
Echo Working ...
Echo.>>%log%
Echo **********XCOPY Parms/Forms from IRDTEMPLATE**********>>%log%
xcopy %ProductionSrv%\irdimagetemplates\Parms %ProductionSrv%\bank\T%CN%\Parms /Y>>%log%
Echo.>>%log%
rem md %ProductionSrv%\bank\T%CN%\Forms
Echo D | xcopy %ProductionSrv%\irdimagetemplates\Forms %ProductionSrv%\bank\T%CN%\Forms /Y>>%log%
Echo.>>%log%
Echo D | xcopy %ProductionSrv%\bank\T%CN%\Forms %ProductionSrv%\bank\%CN%\Forms /Y>>%log%
Echo **********XCOPY for T%CN% Finished %M%/%D%/%Y% %Time%**********>>%log%
Rem Delete Date.ctl
cd\
Y:
cd bank\T%CN%\Parms
Echo Deleting Date.ctl from %ProductionSrv%\bank\T%CN%\Parms>>%log% & Del /P Date.ctl & Echo Date.ctl deleted & Sleep 2
Examples of code I have found ... (Might be useful for others on other things, seems pretty cool)
@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
:initProgress max format -- initialize an internal progress counter and display the progress in percent
:: -- max [in] - progress counter maximum, equal to 100 percent
:: -- format [in,opt] - title string formatter, default is '[P] completed.'
:$created 20060101 :$changed 20080327
:$source http://www.dostips.com
set /a "ProgressCnt=-1"
set /a "ProgressMax=%~1"
set "ProgressFormat=%~2"
if not defined ProgressFormat set "ProgressFormat=[PPPP]"
set "ProgressFormat=%ProgressFormat:[PPPP]=[P] completed.%"
call:doProgress
EXIT /b
:doProgress -- display the next progress tick
:$created 20060101 :$changed 20080327
:$source http://www.dostips.com
set /a "ProgressCnt+=1"
SETLOCAL ENABLEDELAYEDEXPANSION
set /a "per100=100*ProgressCnt/ProgressMax"
set /a "per10=per100/10"
set /a "per10m=10-per100/10-1"
set "P=%per100%%%"
set "PP="
for /l %%N in (0,1,%per10%) do call set "PP=%%PP%%*"
for /l %%N in (%per10%,1,9) do call set "PP=%%PP%% "
set "PPP="
for /l %%N in (0,1,%per10m%) do call set "PPP=%%PPP%%*"
set "ProgressFormat=%ProgressFormat:[P]=!P!%"
set "ProgressFormat=%ProgressFormat:[PP]=!PP!%"
set "ProgressFormat=%ProgressFormat:[PPP]=!PPP!%"
title %ProgressFormat%
EXIT /b
REM http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/Q_23923370.html
@echo off
setlocal enabledelayedexpansion
echo.
echo.
set i=1
cls
(Set /P j=Running the command) < NUL
ECHO.
echo.
FOR /l %%a in (1,1,79) do set j=!j!²
FOR /l %%a in (1,1,79) do set j=!j!
(Set /P j=!j!) < NUL
:start
call :show %i%
:put the command in the next line
ping -n 1 127.0.0.1 > NUL
set /a i = i + 1
if /i %i% leq 79 goto start
ECHO.
ECHO.
(Set /P j=End) < NUL
ECHO.
PAUSE>NUL
goto :EOF
:show
(Set /P j=Û) < NUL
set /a p=(%1*100)/79
title !p!%% Done
exit /b
endlocal