标签:windows bat 批处理 find findstr
windows统计数据库连接数批处理及find和findstr查找命令并创建批处理bat脚本
@echo on
set CurDate=%date:~0,10%
set CurTime=%time%
set hh=%CurTime:~0,2%
if /i %hh% LSS 10 ( 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 统计数据库连接数 %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数据库连接数为: >>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数据库连接数为: >>mysqlccount.txt
netstat -an|findstr /I "10.10.10.189:1433" |find /v /c "" >>mysqlccount.txt
echo. >>mysqlccount.txt
本文出自 “心愿” 博客,请务必保留此出处http://xinyuan8.blog.51cto.com/677906/1615312
windows统计数据库连接数批处理及find和findstr查找命令使用--笔记
标签:windows bat 批处理 find findstr
原文地址:http://xinyuan8.blog.51cto.com/677906/1615312