Windows Batch System Info to HTML

后端 未结 2 2047
耶瑟儿~
耶瑟儿~ 2020-12-11 08:38

I am trying to create a batch file that will use the systeminfo command to put things such as the OS, domain currently logged onto, manufacture, computer model, etc. into an

2条回答
  •  没有蜡笔的小新
    2020-12-11 09:27

    The following should work for you. Happy to provide any explanation.

    @echo off
    (
    echo ^
    systeminfo | findstr /B /C:"OS Name" /C:"OS Version" /C:"OS Manufacturer" /C:"OS Configuration" /C:"OS Build Type" /C:"Original Install Date" /C:"System Boot Time" /C:"System Manufacturer" /C:"System Model" /C:"System Type" /C:"Processor(s)" /C:"BIOS Version" /C:"Windows Directory" /C:"System Directory" /C:"Boot Device" /C:"System Locale" /C:"Input Locale" /C:"Total Physical Memory" /C:"Available Physical Memory" /C:"Virtual Memory: Max Size" /C:"Virtual Memory: Available" /C:"Virtual Memory: In Use" /C:"Domain" /C:"Network Card(s)">f.txt
    for /f "tokens=1* delims=:" %%a in (f.txt) do echo ^^%%a^ ^%%b^^
    echo ^
    ) >test.html
    

    Obviously change the >>test.html to be the name of whatever file you want to output to, I suggest a variable might be best. You also might want to delete f.txt at the end of the script. You can style it by echoing whatever CSS to (I've used) test.html.

提交回复
热议问题