windows-命令收集

windows 服务安装卸载

# 注意空格 sc create "Memcached_11233" start= auto binPath= "D:\box\memcached\memcached.exe -d runservice -m 128 -c 512 -p 11233 -l 127.0.0.1" DisplayName= "Memcached_11233" ---- sc delete Memcached_11233

删除windows\temp 5天前以sess*开头的文件

forfiles /p "C:\Windows\Temp" /s /d -5 /m sess* /c "cmd /c del /f /q /s @path"

windows 端口转发

## 转发不生效需先安装 ipv6 C:\>netsh interface ipv6 install ## 转发本机ip端口 到其他服务器ip端口 C:\>netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=10055 connectaddress=10.42.0.58 connectport=10050 ## 查看已设置的转发 C:\>netsh interface portproxy show all ## 删除端口转发 C:\>netsh interface portproxy delete v4tov4 listenaddress=0.0.0.0 listenport=10055

修改ntp同步频率

regedit: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient\SpecialPollInterval 900=15分钟 3600=1小时 默认: 604800是由7(天)×24(时)×60(分)×60(秒)

windows mysql 备份

@echo off title mysql-client set "Ymd=%date:~,4%%date:~5,2%%date:~8,2%" echo %Ymd% C: "D:\xx\mysqldump.exe" -h<ip> -P<port> -u<user> -p<passwrod> -R <数据库名称> > D:\DatabaseBak\xxx_%Ymd%.sql

查看80端口连接数

netstat -an -p tcp | find /c "80"