Missing Operator? Please help.

August 26, 2011 at 11:49:04
Specs: Windows 7

I'm simply trying to create a *ghetto* progress bar in batch coding.
What i have at the moment is as follows:
\start code\
@echo off
setlocal enabledelayedexpansion
set i=1.25
call :DisplayProgressBar %i%
ping localhost -n 1 > NUL
:not sure what to put next
set /a i = i + 1
if /i %i% leq 80 goto start
(Set /P hello=Done) < NUL
goto :EOF
(Set /P "hello=>") < NUL
title %i% Percent Complete
end /b
\end code\

So i'm kind of a noob when it comes to this stuff, but the previous code (...if /i %i% leq 100 goto start...) had two rows of dots, so i changed it to 80 (one whole row) then tried putting 1.25 for i (100/80=1.25%) cause i want it to go up to 100% complete in the title, but it says "1.25% Complete" then "2% Complete." up to only 80.

If anyone could explain to me what I'm doing wrong, that would be much appreciated.

PS. If you need clarification on something, or the original code just tell me.

See More: Missing Operator? Please help.

Report •

August 26, 2011 at 13:10:47
CMD allows only integer math, so whole numbers only. Also, you should use the formula:
NumberProcessed / TotalNumber * 100

Or, since you're limited to integer math:
(NumberProcessed * 100) / TotalNumber

How To Ask Questions The Smart Way

Report •

August 27, 2011 at 05:27:30
Thanks for your help, i think i understand what to do now.

Report •
Related Solutions

Ask Question