|
Question : how to do simple math from dos command line (for my batch file)
|
|
My company host around 50 email domains. in recent 3 months, our customers always complaint they don't get new message. if I go into the smtp queue, I will find thousands of messages sitting in the Message with an unreachable destination Queue. sometimes it will be fixed by restarting the virtual smtp server, and sometimes by deleting some old junk messages. (our mail server has been restrictedly blocked any open relay, and the exchange server service pack and security patches are up to date)
I am trying to implement a batch file to monitor the smtp queue directory. I want the batch file to check the queue every one hour, and send me an email if the queue has more than 1000 messages - normally it's having problem with either sending or receiving. here is my thought:
for / r C:\Program Files\Exchsrvr\Mailroot\vsi 1\Queue %i in (*) do set i=%i+1
I want the DO command to do a simple math to count how many messages (something like: set i=%i+1, this doesn't work for me)
Any idea?
Thanks
Jerry Jay email: [email protected]
|
Answer : how to do simple math from dos command line (for my batch file)
|
|
No need for math:
@echo off setlocal set QueuePath=C:\Program Files\Exchsrvr\Mailroot\vsi 1\Queue set FileCount=0 for /f %%a in ('dir /s /a:-d "%QueuePath%" ^| find "File(s)"') do set FileCount=%%a echo %FileCount%
|
|
|
|