Programming Field

Systeminfo - DOS/Command Prompt Reference

[Windows NT series] Displays the system information of the computer on the screen.

Syntax

systeminfo[.exe] [/S <remote-system> [/U <user-name> [/P [<password>]]]]
  [/FO <output-format>] [/NH]

Options

/S <remote-system> Specifies the name of the computer (local/remote) from which to retrieve system information. <remote-system> will be an IP address or hostname. If omitted, the local computer will be the target.
/U <user-name> [/P [<password>]]

Specifies the login name and password when providing a computer name. You can include a domain name in <user-name> (in the format ‘domain\username’). If omitted, the user who executes this command will be used.

Password specification works as follows:

  • If the entire ‘/P [<password>]’ is omitted, no password is set.
  • If only ‘/P’ is specified without providing ‘<password>’, a prompt will be displayed, prompting the user to enter the password (the entered password in this prompt is typically displayed as ‘*’).
/FO <output-format>

Specifies the format for output on the screen. Three possible values can be specified. If /FO is omitted, the format defaults to ‘LIST’.

ValueMeaning
TABLEOutputs in a pseudo table format. Since system information has many items and uses a wide format, it may cause display issues with the default command prompt width.
LISTOutputs in a ‘key: value’ format, making it convenient for human-readable verification of the output. Additionally, since there are no colons (‘:’) in the item names (as confirmed in Windows 10), it may be easier to parse using the For command for certain items.
CSVOutputs in CSV format, which is useful for analyzing output results in various scripting languages or programs. While parsing with the For command is possible to some extent, if there are delimiter characters within double quotes, careful parsing methods may be required.
/NH Suppresses headers when displaying in TABLE or CSV format.

Details

Usage of Systeminfo

The Systeminfo program reads various system information at runtime and outputs the results. Depending on the computer's state, the reading process may take several seconds.

Note that the order of items output in TABLE or CSV format does not change with each execution, but it may vary depending on factors such as the operating system version.

Samples

Sample (Batch file)

@echo off
for /f "tokens=1,* delims=:" %%A in ('systeminfo') do if "%%A"=="BIOS Version" call :UseBIOSVersion %%B
exit /b

:UseBIOSVersion
    set "BIOS_VERSION=%*"
    exit /b

[Extensions] The content of ‘BIOS Version’ from system information will be set to the environment variable ‘BIOS_VERSION’. In this example, LIST format output is parsed using the For command. This approach is taken because there is a possibility of commas in the output before ‘BIOS Version’, making CSV parsing with the For command cumbersome. Additionally, the usage of the Call command is employed for the purpose of removing multiple space characters between ‘:’ and the item content in ‘BIOS Version: XXXXXX’.