1.

Solve : Help with making a bat file for log filing?

Answer»

I'm looking to make a batch FILE that can create about 2000 very small logfiles (Just a simple netstat -N command) so I can do some IP address specific logging. Is there anyways to create a counting number, similar to c++ where the variable would just be similar to a++ would mean a would increase by 1 each time?

I'd rather not have to make a 2000 line batch file if I can do it in a few lines with a loop &GT;.<

I FIGURE the baseline to the batch file would be similar to this:

:loop
netstat -n >> IPlog1.txt
goto loop

However it needs to stop at IPlog2000.txt

Also would it be possible to insert (in milliseconds) the date?:loop
set /a num +=1
netstat -n > IPLOG%num%.log
if %num% equ 2000 goto eof
goto loop
:eof
exit

Time is not in the date command or the date variable. Use %time%. It already has milliseconds. For /l %%A in (1,1,2000) do (
netstat -n > IPlog%%A.txt
)

Welcome to the CH forums.Quote from: Dusty on October 12, 2009, 09:11:05 PM

For /l %%A in (1,1,2000) do (
netstat -n > IPlog%%A.txt
)

Welcome to the CH forums.
or use a for loop as dusty has given. Perfect - Thanks for the help fellas. Also thanks for the welcoming ^.^


Discussion

No Comment Found