Progress Percentage During Copy Using A Batch

December 29, 2010 at 07:20:01
Specs: Windows XP Pro
Hello All. I used some code I found here to show the progress based on a percent while using xcopy to copy some files. Here is the code I am using:
@echo off

for /f "tokens=3 delims=\" %%i in ("%USERPROFILE%") DO (set user=%%i)

setlocal EnableDelayedExpansion



set Count1=0
set Count2=0

for /f "tokens=*" %%a in ('dir /a-d-s/s/b "c:\Documents and settings\%user%\my documents\test 2\kps apps"') do set /a Count1+=1
for /f "tokens=*" %%a in ('dir /a-d-s/s/b l:\"kps apps 2"') do set /a Count2+=1

echo %Count1%
echo %Count2%

::ping -n 10 > nul

set /a Percent=%Count2%/%Count1%*100
If %percent%==100 goto fincopy
IF not %percent%==0 goto end
IF %percent%==0 goto start



echo %Percent% Percent Complete

goto loop


echo Finished Copying

ping -n 5 > nul


This works well but I would like to know where I could insert my "xcopy" line into this so I do not have to run two batch files. If this is not possible is there a way to open both batch files at the same time to make it more automated. I am new to this so these might be easy questions to answer. Thanks for the help in advance.

See More: Progress Percentage During Copy Using A Batch

Report •

January 5, 2011 at 14:46:43
Never mind, I figured it out.

Report •

January 11, 2011 at 10:17:45
And the answer is?

Report •

Related Solutions

Ask Question