Page 1 of 1

Hardawre Profile script has messy output

Posted: 13 Jan 2022 22:07
by Jedininja
Hey, this script is intended to make a profile of a workstation. It works well but the out put is messy and very hard to read. i am wondering if anyone knows how to organize the output to a file in a cleaner manor.

Code: Select all

Set mainmenu=h

:Hardawre Profile
IF EXIST %crc% ( ECHO Running Hardware Profiling Script...
(
WMIC BASEBOARD
WMIC BIOS
WMIC CPU
WMIC MEMORYCHIP
WMIC MEMPHYSICAL
WMIC CDROM
WMIC PRINTER
WMIC OS
WMIC NIC
WMIC SOUNDDEV
) > %hp% & CALL %hp% & GOTO %h% ) ELSE ECHO %dde% & PAUSE & GOTO %h%
any idea i have been playing with is to use the

Code: Select all

wmic get
command to retrieve data based on the table header, however i do not feel that this would work universally and meet needs of potential users as it is leaving out data which may be needed.

i have deduced the disorganization in the output file to column headers and columns content being different lengths, i however have no idea how to address that issue.

another idea for addressing this problem was to use the

Code: Select all

systeminfo
command first in the script and subtract that data contained in the

Code: Select all

systeminfo
output from the string of

Code: Select all

wmic
commands with

Code: Select all

wmic get
commands but it does not solve the messy output file..

Code: Select all

%crc%
is the path of the main script, %hp% is the path\filename ("hardware profile.txt"),

Code: Select all

%dde%
is an error message say the rootdir does not exist and

Code: Select all

%h%
is the main menu.

Re: Hardawre Profile script has messy output

Posted: 14 Jan 2022 07:18
by atfon
WMIC has several output formats. For example:

Code: Select all

wmic baseboard list /format:value
You can replace the word "value" with several other options, like htable. To see a list of potential formats, use this command:

Code: Select all

wmic baseboard list /format /?
This site has some good information:

https://petri.com/command-line-wmi-part-3