@echo off >systeminfo.txt echo CPU_start for /f "tokens=*" %%i in ('wmic cpu get name') do echo. %%i >>systeminfo.txt for /f "tokens=*" %%i in ('wmic cpu get numberofcores') do echo. %%i >>systeminfo.txt >>systeminfo.txt echo CPU_end >>systeminfo.txt echo MEMORY_start for /f "tokens=*" %%i in ('wmic memphysical get memorydevices ^|find/i " "') do echo. %%i >>systeminfo.txt for /f "tokens=*" %%i in ('wmic memphysical get maxcapacity ^|find/i " "') do echo. %%i >>systeminfo.txt >>systeminfo.txt echo MEMORY_end >>systeminfo.txt echo DISK_start for /f "tokens=*" %%i in ('wmic diskdrive get caption ^|find/i " "') do echo. %%i >>systeminfo.txt for /f "tokens=*" %%i in ('wmic diskdrive get size ^|find/i " "') do echo. %%i >>systeminfo.txt >>systeminfo.txt echo DISK_end >>systeminfo.txt echo NICCONFIG_start rem wmic nicconfig get ipaddress,macaddress |find/i "192.168.3" >nul rem if %errorlevel%==1 (set "ip=192.168.2") else (set "ip=192.168.3") for /f "tokens=*" %%i in ('wmic nicconfig get ipaddress^,macaddress^,DNSHostName ^|find/i "192.168.2"') do >> systeminfo.txt echo. %%i for /f "tokens=*" %%i in ('wmic nicconfig get ipaddress^,macaddress^,DNSHostName ^|find/i "192.168.3"') do >> systeminfo.txt echo. %%i >>systeminfo.txt echo NICCONFIG_end setlocal enabledelayedexpansion for /f "tokens=1" %%i in ('wmic nicconfig get ipaddress^,DNSHostName ^|find/i "192.168."') do ( set hostname1=%%i set hostname1=!hostname1: =! ) cd.>ip_mac.csv wmic nicconfig get ipaddress,macaddress |find/i "192.168.2" >nul if %errorlevel%==0 ( for /f "tokens=2 delims=}" %%i in ('wmic nicconfig get ipaddress^,macaddress ^|find/i "192.168.2"') do ( set mac1=%%i set mac1=!mac1: =! ) for /f "tokens=1 delims={,}" %%i in ('wmic nicconfig get ipaddress^,macaddress ^|find/i "192.168.2"') do ( set ip1=%%i set ip1=!ip1:"=! >>ip_mac.csv echo ,!ip1!,!mac1!,!hostname1! ) ) wmic nicconfig get ipaddress,macaddress |find/i "192.168.3" >nul if %errorlevel%==0 ( for /f "tokens=2 delims=}" %%i in ('wmic nicconfig get ipaddress^,macaddress ^|find/i "192.168.3"') do ( set mac2=%%i set mac2=!mac2: =! ) for /f "tokens=1 delims={,}" %%i in ('wmic nicconfig get ipaddress^,macaddress ^|find/i "192.168.3"') do ( set ip2=%%i set ip2=!ip2:"=! >>ip_mac.csv echo ,!ip2!,!mac2!,!hostname1! ) ) echo. echo. echo. 请将生成的文件名(ip_mac.csv)修改为 自己姓名.csv echo. systeminfo.txt修改为 自己姓名.txt echo. 然后将文件以邮件形式发回 echo. pause goto :eof :getsysinfotocsv for /f "tokens=*" %%i in ('type systeminfo.txt') do ( if "!action_cpu!"=="1" ( set "title=cpu," if not defined cpu_name set "cpu_name=%%i" set "value1=!cpu_name:~,-3!," && set "value2=!value2!," set action_cpu=0 ) echo "%%i" |find "Name" >nul if !errorlevel!==0 set action_cpu=1 if !action_core!==1 ( set "title=!title!核心," if not defined cpu_core set "cpu_core=%%i" set "value1=!value1!!cpu_core:~,-3!," && set "value2=!value2!," set action_core=0 ) echo "%%i" |find "NumberOfCores" >nul if !errorlevel!==0 set action_core=1 if !action_MemoryDevices!==1 ( set "title=!title!内存条," if not defined MemoryDevices set "MemoryDevices=%%i" set "value1=!value1!!MemoryDevices:~,-3!," && set "value2=!value2!," set action_MemoryDevices=0 ) echo "%%i" |find "MemoryDevices" >nul if !errorlevel!==0 set action_MemoryDevices=1 if !action_MaxCapacity!==1 ( set "title=!title!总内存," if not defined MaxCapacity set "MaxCapacity=%%i" set/a MaxCapacity=!MaxCapacity: =!/1024/1024 set "value1=!value1!!MaxCapacity!G," && set "value2=!value2!," set action_MaxCapacity=0 ) echo "%%i" |find "MaxCapacity" >nul if !errorlevel!==0 set action_MaxCapacity=1 echo "%%i" |find "Size" >nul if !errorlevel!==0 set action_Caption=0 if "!action_Caption!"=="1" ( set/a caption_num+=1 if "!caption_num!" == "1" ( set "title=!title!硬盘," set "Caption=%%i" set "value1=!value1!!Caption:~,-3!," ) else ( set value1!caption_num!=!value2!, ) ) echo "%%i" |find "Caption" >nul if !errorlevel!==0 set action_Caption=1 echo "%%i" |find "DISK_end" >nul if !errorlevel!==0 set action_Size=0 if !action_Size!==1 ( set "title=!title!硬盘大小," set "Size=%%i" set "value1=!value1!!Size:~,-3!," set action_Size=0 ) echo "%%i" |find "Size" >nul if !errorlevel!==0 set action_Size=1 ) >systeminfo.csv echo !title! >>systeminfo.csv echo !value1! for /l %%i in (1 1 !caption_num!) do echo !value1%%i! pause goto :eof :test111 cd.>systemok.csv for /f "tokens=*" %%i in ('more systeminfo.csv') do >>systemok.csv echo %%i echo !title! echo !cpu_name!,!cpu_core!, echo !cpu_name:~,-1!,!cpu_core:~,-1!, echo !value1!
© 著作权归作者所有
下一篇: 自动释放内存
文章评论(0)