This should work in most DOS from 5.0 up and in w2k/XP.
::
@echo off > quit.bat choice /c:123456789 Enter an integer
if errorlevel 9 goto 9 if errorlevel 8 goto 8 if errorlevel 7 goto 7 if errorlevel 6 goto 6 if errorlevel 5 goto 5 if errorlevel 4 goto 4 if errorlevel 3 goto 3 if errorlevel 2 goto 2 if errorlevel 1 goto 1
:9 set NUMloops=********* goto process
:8 set NUMloops=******** goto process
:7 set NUMloops=******* goto process
:6 set NUMloops=****** goto process
:5 set NUMloops=***** goto process
:4 set NUMloops=**** goto process
:3 set NUMloops=*** goto process
:2 set NUMloops=** goto process
:1 set NUMloops=* goto process
:process echo NUMloops=%NUMloops% set loopNUM=
:loop if %NUMloops%'==%loopNUM%' quit
::**********************************
:: The thing to be done goes here
::**********************************
set loopNUM=%loopNUM%* echo %loopNUM% goto loop
::**
HTH
M2
If at first you don't succeed, you're about average.
I'm just exploring further improvements on the above batch script.Well, the above script process a user's choice for FTP command (3M file download test , 5 M file download test, etc) and prompt for number of loop to execute.
Well, the above portion has been settled.It works.
However, my main challenge is how to include date and time stampings against their coresponding ftp results and format the output nicely to a text file row by row ? Eg : Sat 02/04/05 23:59 - ftp: 2742001 bytes received in 13.69Seconds 200.29Kbytes/sec. Sat 02/04/05 00:01 - ftp: 2742001 bytes received in 12.23Seconds 235.04Kbytes/sec. : : :
For the above, I can settle the date and time stamping output to a text file and also i can use the 'find' command to extract the ftp results and output to the same txt file as the date/time.But, i simply unsure how to format them nicely row by row.
While you're doing all these looped ftp transfers, and burning up bandwidth, try to keep in mind that folks on the bottom end of the food chain get 5KB/s on the best of days.
Teah, problem is when you echo or pipe the date/time and the find output to a file, each append adds a 'line break'.
CRLF [0d0a hex]
So you need to chop out the 0d0a. To use only DOS/NT it comes down to DEBUG.
So, your choice, DEBUG or a 3rd party utility.
M2
If at first you don't succeed, you're about average.
Either way, we'll 'keep it public'; the assumption being that many others are reading and learning.
Sorry to take so long; had to go to Burma today [!].
Didn't mean to 'baffle with brilliance' .
Each time you ECHO or PIPE into a file you get, along with the desired text, a 'line break', commonly called CRLF or 0d0a.
So the file 'looks like' separate lines.
This is not what you want. As per you example, you want each line to have:
date time somestring
So we need to get rid of the 'line breaks'.
A third party util works as well but frustrates using the script on a box which does not have the utility. So we'll use DEBUG.
This BAT will put the date and time and the output of your FIND into a file with all that on one line and append it to MYBIG.LOG *** Does this need to work in NT & DOS?
M2
If at first you don't succeed, you're about average.
Howeveer, I'm aware of the search for my "find" command.But, i'm just wondering how can i format the results into proper row with date/time on the corresponding results?
Also, for the the Kbytes/s , how to convert to kbits/s by multiplying by 8.Can DOS do it?
The information on Computing.Net is the opinions of its users. Such
opinions may not be accurate and they are to be used at your own risk.
Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE