我想使用 bat 文件收集系统信息

我想使用 bat 文件收集系统信息

希望你们都一切顺利。请帮助我。

我想使用 bat 文件收集系统信息,例如:

  1. 软件列表
  2. 操作系统信息
  3. 系统硬件详细信息。

我有一些代码可以收集电脑中的软件列表,我也想获取网络级别的所有信息。

@echo off
echo ================= Created by Vikram Raj Kumar Majji
>>software_list.txt
reg export HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall temp1.txt
find "DisplayName" temp1.txt| find /V "ParentDisplayName" > temp2.txt
for /f "tokens=2,3 delims==" %%a in (temp2.txt) do (echo %%a >> software_list.txt)
del temp1.txt
del temp2.txt
REM type software_list.txt | more
echo.
echo.
echo Installed software are stored in software_list.txt

答案1

systeminfo下面是一个使用输出HTML作为奖励的示例(-_°)

@echo off
CHCP 65001>nul
Title System Info With HTML Output by Hackoo
Color 0B & Mode 57,3
Set Systeminfo_TXT=%~dp0Systeminfo_%ComputerName%.txt
Set Systeminfo_HTML=%~dp0Systeminfo_%ComputerName%.html
echo(
systeminfo>"%Systeminfo_TXT%"
call :CreateHTMLtable "%Systeminfo_TXT%" "%Systeminfo_HTML%"
Start "" "%Systeminfo_HTML%"
Exit /b
::------------------------------------------------------------------------------------------------------------------------------------------------------
:CreateHTMLTable <inputfile> <outputfile>
>"%~2" ( 
    echo ^<!DOCTYPE HTML PUBLIC 
    echo "-//W3C//DTD HTML 4.01 Transitional//EN"
    echo  "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"^>
    echo ^<HTML^>
    echo ^<HEAD^>
    echo ^<META HTTP-EQUIV="Content-Type" 
    echo CONTENT="text/html; charset=utf-8"^>
    echo ^</HEAD^>
    echo ^<BODY^>
    echo ^<style type="text/css"^>
    echo .tftable {font-weight: bold;font-size:16px;color:#333333;width:100%;border-width: 1px;border-color: #bcaf91;border-collapse: collapse;}
    echo .tftable th {font-size:16px;background-color:#ded0b0;border-width: 1px;padding: 8px;border-style: solid;border-color: #bcaf91;text-align:left;}
    echo .tftable tr {background-color:#e9dbbb;}
    echo .tftable td {font-size:16px;border-width: 1px;padding: 8px;border-style: solid;border-color: #bcaf91;}
    echo .tftable tr:hover {background-color:#ffffff;}
    echo ^</style^>
    echo ^<center^>^<table class="tftable" border="1"^>
)
@for /f "tokens=1,* delims==:" %%a in ('Type "%~1"') do (
    >>"%~2" echo ^<tr^>^<td^>%%a^</td^>^<td^>%%b^</td^>^</tr^>
)
>>"%~2" (
    echo ^</table^>
    echo ^</BODY^>
    echo ^</HTML^>
)
Exit /B
::------------------------------------------------------------------------------------------------------------------------------------------------------

相关内容