Windows Statistics database connections batch and find and findstr find commands and create batch bat scripts
@echo on
Set curdate=%date:~0,10%
Set curtime=%time%
Set hh=%curtime:~0,2%
if/i%hh% LSS (set hh=0%curtime:~1,1%)
Set mm=%curtime:~3,2%
Set ss=%curtime:~6,2%
Set curdatetime=%curdate%_%hh%:%mm%:%ss%
Set Curdatetime
D:
CD \
Echo =================================================================== >>mysqlccount.txt
Echo Statistics Database connection number%curdatetime% >>mysqlccount.txt
Echo =================================================================== >>mysqlccount.txt
Echo. >>mysqlccount.txt
netstat-an|findstr/i "10.10.10.189:3306 127.0.0.1:3306" >>mysqlccount.txt
Echo. >>mysqlccount.txt
echo MySQL database connection number: >>mysqlccount.txt
netstat-an|findstr/i "10.10.10.189:3306 127.0.0.1:3306" |find/v/C "" >>mysqlccount.txt
Echo. >>mysqlccount.txt
Echo-------------------------------------------------------------------->>mysqlccount.txt
Echo. >>mysqlccount.txt
netstat-an|findstr/i "10.10.10.189:1433" >>mysqlccount.txt
Echo. >>mysqlccount.txt
echo Sqserver Database connection number: >>mysqlccount.txt
netstat-an|findstr/i "10.10.10.189:1433" |find/v/C "" >>mysqlccount.txt
Echo. >>mysqlccount.txt
This article is from the "Wish" blog, please be sure to keep this source http://xinyuan8.blog.51cto.com/677906/1615312
Windows Statistics database Connections batch processing and find and FINDSTR lookup commands using--notes