check-system-info/sbin/get_sys_info.bat

45 lines
1.0 KiB
Batchfile
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@echo off
echo 开始获取本机信息,请稍等......
rem 代理的logs路径
set agentlog="D:\agent\ubackup\uagent\logs"
rem 定义输出的文件
for /f "tokens=*" %%i in ('powershell -c "Get-Date -UFormat %%V"') do (
set vars=%%i
)
set filename=C:\ComputerInfos_week_%vars%.txt
echo 本周是第:%vars%>>%filename%
SET CurrentTime=%date:~0,10% %time:~0,5%
echo 本次运行时间:%CurrentTime% >>%filename%
rem 查看内存使用情况
echo 1.内存使用情况:>>%filename%
wmic OS get FreePhysicalMemory| findstr /r /v "^$" | more >>%filename%
wmic ComputerSystem get TotalPhysicalMemory| findstr /r /v "^$" |more >>%filename%
rem 查看磁盘使用情况:
echo 2.磁盘使用情况:>>%filename%
wmic logicaldisk get caption,freespace,size| findstr /r /v "^$"|more >>%filename%
rem 查看CPU使用情况
echo 3.CPU使用率>>%filename%
wmic cpu get loadpercentage| findstr /r /v "^$"|more >>%filename%
rem 查看日志文件大小:
echo 4.日志文件路径:>>%filename%
dir %agentlog% >>%filename%
echo "===================%CurrentTime%已经获取系统信息================ " >>%filename%