System Information
"Which Windows build is this?", "How much RAM does it have?", "When did it last reboot?" Support tickets, install scripts and inventory reports all start with questions like these. Command Prompt answers them with a handful of small tools, and batch can turn their text output into exactly the values you need.
| Command | Answers |
|---|---|
hostname |
the computer's name |
whoami |
who you are logged in as (whoami /groups, whoami /all for more) |
ver |
the Windows version and build number |
systeminfo |
OS, hardware, memory, boot time, hotfixes, network cards |
echo %NUMBER_OF_PROCESSORS% |
logical CPUs (also %PROCESSOR_ARCHITECTURE%) |
driverquery |
installed drivers |
winver, msinfo32 |
graphical "About Windows" and System Information windows |
Who and where am I?
hostname and the COMPUTERNAME variable both give the machine name:
@echo off
hostname
echo Computer: %COMPUTERNAME%
echo User: %USERDOMAIN%\%USERNAME%
echo Arch: %PROCESSOR_ARCHITECTURE%TAD
Computer: TAD
User: TAD\learner
Arch: AMD64
On a real PC (sample output, yours will differ):
C:\Users\ada>whoami
desktop-7q2k4lm\ada
C:\Users\ada>ver
Microsoft Windows [Version 10.0.26100.6584]Notice that whoami prints the name in lowercase. And yes, Windows 11 still reports version 10.0: Microsoft kept the major number at 10, and Windows 11 is recognised by its build number (22000 and higher; 26100 is 24H2). The fourth part (.6584) is the monthly update revision.
systeminfo
systeminfo collects a full report. It takes a few seconds because it queries WMI and the hotfix list:
C:\Users\ada>systeminfo
Host Name: DESKTOP-7Q2K4LM
OS Name: Microsoft Windows 11 Pro
OS Version: 10.0.26100 N/A Build 26100
OS Manufacturer: Microsoft Corporation
OS Configuration: Standalone Workstation
OS Build Type: Multiprocessor Free
Registered Owner: ada@example.com
Original Install Date: 3/14/2025, 9:12:44 AM
System Boot Time: 10/16/2026, 8:02:17 AM
System Manufacturer: LENOVO
System Model: 21HD003LUS
System Type: x64-based PC
Processor(s): 1 Processor(s) Installed.
[01]: Intel64 Family 6 Model 186 Stepping 2 GenuineIntel ~1900 Mhz
BIOS Version: LENOVO R2FET45W (1.25 ), 5/20/2025
Windows Directory: C:\WINDOWS
System Directory: C:\WINDOWS\system32
Boot Device: \Device\HarddiskVolume1
System Locale: en-us;English (United States)
Time Zone: (UTC-05:00) Eastern Time (US & Canada)
Total Physical Memory: 32,452 MB
Available Physical Memory: 18,903 MB
Virtual Memory: Max Size: 37,316 MB
Virtual Memory: Available: 20,118 MB
Virtual Memory: In Use: 17,198 MB
Page File Location(s): C:\pagefile.sys
Domain: WORKGROUP
Logon Server: \\DESKTOP-7Q2K4LM
Hotfix(s): 3 Hotfix(s) Installed.
[01]: KB5043080
[02]: KB5065426
[03]: KB5066131
Network Card(s): 1 NIC(s) Installed.
[01]: Intel(R) Wi-Fi 6E AX211 160MHz
Connection Name: Wi-Fi
DHCP Enabled: Yes
Hyper-V Requirements: A hypervisor has been detected. Features required for Hyper-V will not be displayed.Sample output, shortened. The fields people look for most:
| Field | Meaning |
|---|---|
OS Name, OS Version |
edition (Home, Pro, Enterprise) and build |
Original Install Date |
when this Windows was installed (or last upgraded in place) |
System Boot Time |
last full boot; uptime = now minus this. Fast Startup can make it older than you expect |
System Type |
x64-based PC or ARM64-based PC |
Total / Available Physical Memory |
installed RAM and what's free right now |
Virtual Memory |
RAM + page file (Swap & the Page File) |
Domain |
WORKGROUP for a home PC, or the company's Active Directory domain |
Hotfix(s) |
installed updates (KB numbers) |
Hyper-V Requirements |
virtualization support (here: a hypervisor is already running, e.g. for WSL 2) |
Useful switches: /fo list|table|csv chooses the format, /nh drops the CSV/table header, and /s computer /u user queries another machine on the network.
The labels are localized: on a German Windows, OS Name is Betriebssystemname. Scripts that must run worldwide should use PowerShell or the CSV format by column position rather than by label.
Filtering with findstr
The usual trick is to pipe systeminfo into findstr with ^ (start of line) and one /c: per label:
C:\Users\ada>systeminfo | findstr /r /c:"^OS Name" /c:"^OS Version" /c:"^Total Physical"
OS Name: Microsoft Windows 11 Pro
OS Version: 10.0.26100 N/A Build 26100
Total Physical Memory: 32,452 MBThe playground can't run systeminfo, so the runnable examples below save a few of its lines to a file first and then work on that text, which is exactly what your script would do with the live output.
@echo off
(
echo Host Name: DESKTOP-7Q2K4LM
echo OS Name: Microsoft Windows 11 Pro
echo OS Version: 10.0.26100 N/A Build 26100
echo System Type: x64-based PC
echo Total Physical Memory: 32,452 MB
echo Available Physical Memory: 18,903 MB
echo Virtual Memory: Max Size: 37,316 MB
) > sysinfo.txt
findstr /r /c:"^OS Name" /c:"^OS Version" /c:"^Total Physical" sysinfo.txtOS Name: Microsoft Windows 11 Pro
OS Version: 10.0.26100 N/A Build 26100
Total Physical Memory: 32,452 MB
/c:"..." makes the text one literal search string (spaces included), and /r turns on regular expressions so ^ means "line starts with". Without ^, OS Name would also match a line that merely contains it somewhere.
Parsing values into variables
To use a value you need it in a variable. for /f "tokens=1,* delims=:" splits each line at the first colon: %%a is the label and %%b is everything after it. The value still has leading spaces, which a second for /f (default delimiters are space and tab) removes. See for /f: Parse Text for the details:
@echo off
setlocal enabledelayedexpansion
(
echo Host Name: DESKTOP-7Q2K4LM
echo OS Name: Microsoft Windows 11 Pro
echo OS Version: 10.0.26100 N/A Build 26100
echo System Type: x64-based PC
echo Total Physical Memory: 32,452 MB
echo Available Physical Memory: 18,903 MB
echo Virtual Memory: Max Size: 37,316 MB
) > sysinfo.txt
for /f "tokens=1,* delims=:" %%a in (sysinfo.txt) do (
for /f "tokens=*" %%v in ("%%b") do (
if "%%a"=="Host Name" set "host=%%v"
if "%%a"=="OS Version" set "osver=%%v"
if "%%a"=="Total Physical Memory" set "ram=%%v"
if "%%a"=="Available Physical Memory" set "free=%%v"
if "%%a"=="Virtual Memory" echo careful: Virtual Memory gave [%%v]
)
)
for /f "tokens=4" %%n in ("%osver%") do set "build=%%n"
set "ram=%ram:,=%"
set "free=%free:,=%"
set /a ramMB=%ram: MB=%, freeMB=%free: MB=%, usedPct=(ramMB-freeMB)*100/ramMB
echo Computer : %host%
echo Build : %build%
if %build% GEQ 22000 (echo Release : Windows 11) else (echo Release : Windows 10)
echo RAM : %ramMB% MB, %usedPct%%% in usecareful: Virtual Memory gave [Max Size: 37,316 MB]
Computer : DESKTOP-7Q2K4LM
Build : 26100
Release : Windows 11
RAM : 32452 MB, 41% in use
Three things worth noticing:
- Labels that contain a colon (
Virtual Memory: Max Size:) break the split: the label becomesVirtual Memoryand the rest lands in the value. Match on the whole line withfindstrwhen that matters. 32,452 MBis text.%ram:,=%deletes the thousands separator and%free: MB=%the unit, leaving a numberset /acan use (see String Manipulation and set /a Arithmetic).%%%inechoprints a single%:%%is an escaped percent sign in a batch file.
Counting lines
How many hotfixes are installed? Count the KB lines. Batch has no wc -l, but a for /f loop with a counter does the job (find /c can count too, but a loop works on any text you feed it):
@echo off
(
echo Hotfix(s^): 3 Hotfix(s^) Installed.
echo [01]: KB5043080
echo [02]: KB5065426
echo [03]: KB5066131
echo Network Card(s^): 1 NIC(s^) Installed.
) > hotfix.txt
set /a count=0
for /f "tokens=2 delims= " %%k in ('findstr /c:": KB" hotfix.txt') do (
set /a count+=1
echo installed: %%k
)
echo %count% updatesinstalled: KB5043080
installed: KB5065426
installed: KB5066131
3 updates
The ^) escapes are needed because the echo lines sit inside a parenthesized block, where an unescaped ) would end the block early.
Other sources
wmic(wmic os get caption,version) is deprecated. It is no longer installed by default on Windows 11 24H2 and later; don't build new scripts on it.- PowerShell is the modern way and returns objects instead of text, so no parsing is needed:
PS C:\Users\ada> Get-CimInstance Win32_OperatingSystem | Select-Object Caption, BuildNumber, LastBootUpTime
Caption BuildNumber LastBootUpTime
------- ----------- --------------
Microsoft Windows 11 Pro 26100 10/16/2026 8:02:17 AM
PS C:\Users\ada> (Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory / 1GB
31.69Sample output. From a batch file you can call it as powershell -NoProfile -Command "..." inside for /f to capture a single value. Get-ComputerInfo returns everything systeminfo shows as one object.
Learn more: Windows Architecture, for /f: Parse Text, PowerShell on Windows.
Test yourself
ver prints Microsoft Windows [Version 10.0.26100.6584]. Which Windows is it?
- Windows 10, because it says 10.0
- Windows 11: builds 22000 and higher are Windows 11
- Windows Server 2016
- It can't be told from this output
Why does for /f "tokens=1,* delims=:" give a wrong label for the line Virtual Memory: Max Size: 37,316 MB?
- Because tokens=* is not allowed with delims
- It splits at the first colon, so the label is
Virtual MemoryandMax Size: ...ends up in the value - Because for /f skips lines with numbers
- Because the line contains a comma
Which approach is most robust on Windows machines set to different display languages?
systeminfo | findstr "OS Name"- PowerShell's
Get-CimInstance Win32_OperatingSystemproperties - Reading the
veroutput withfindstr - Counting lines of
systeminfo