Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Greetings All!
The following is some DOS code I put together. It allows for a percentage of completion to be displayed of a DOS program. It was created for Admins to monitor progress of DOS programs which run on the network. Often we (Admins) have to run DOS programs and we don't know how long until completion. Now we can! (With limitations...)
The code scans an input file and counts the number of lines to process. It then computes the fractional and displays the result. DOS doesn't like displaying real numbers (12.234 etc) so I had to work the code to simulate a real number output.
Keys: counter(s) in DOS
Keys: real number(s) in DOSStart Code:
-------------REM This program will display the percent of completion
REM in pinging all computers on the domain.
REM
REM Keywords: counter,counters,loop,percent,dos,windows,decimal,complete,completion
REM
REM Written by: Pete Soski (soskip@yahoo.com)
REM Assisted by: Daniel Westphal
REM Creation Date: 21 Aug 2008
REM
cls
@ECHO OFF
net view > clients.txt
setlocal
set Total=0
set Current=0
set PC=0
set MC=0
set Long=0
set Dec=0
set CName=0
set NName=0FOR /F "skip=3" %%i IN (clients.txt) DO (set /A Total+=1)
FOR /F "skip=3" %%i IN (clients.txt) DO (call :MAIN %%i)
goto END:END
Echo.
Echo End of program
Echo.
del clients.txt
set Total=0
set Current=0
set PC=0
set MC=0
set Long=0
set Dec=0
set CName=0
set NName=0
endlocal
exit:MAIN
cls
Echo.
Echo.
set /A Current+=1
set /A PC = ((%Current%*100)/%Total%)
set /A MC = ((%Current%*10000)/%Total%)
set Dec=%MC:~-2%
set Long=%PC%.%dec%
Echo.
Echo Percent Complete: %PC%
Echo Percent Complete, Long form: %Long%
Echo.
set cname=%1%
set nname=%cname:~2%
ping %nname%
if %PC%==100 (pause)---------------
end of codeGood Luck!
~Pete

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |