How to Get Video Card Details in Batch Script
For system inventory, troubleshooting display issues, or checking software requirements, you often need to identify the graphics card (or video controller) installed in a computer. This includes essential details like the model name, the current driver version, and the amount of dedicated video RAM. This information is available through the Windows Management Instrumentation (WMI) framework.
This guide will teach you how to use the built-in WMIC (Windows Management Instrumentation Command-line) utility to query the system for detailed properties of the video controller. You will learn the correct WMI class to query and how to create a useful hardware report from your batch script.
The Core Command: WMIC PATH Win32_VideoController
The standard way to get detailed hardware information is with WMIC. To get video card details, we must query the Win32_VideoController WMI class directly.
Syntax: WMIC PATH Win32_VideoController GET <Property1,Property2,...>
WMIC PATH Win32_VideoController: Specifies the WMI class we are querying.GET ...: The specific properties we want to retrieve.
Key Video Card Properties Explained
NameorCaption: The user-friendly model name of the graphics card (e.g., "NVIDIA GeForce RTX 3080").DriverVersion: The version number of the currently installed display driver. This is crucial for troubleshooting.AdapterRAM: The amount of dedicated video memory on the card, in bytes.Status: The current health status of the device (e.g., "OK", "Error").VideoProcessor: The name of the graphics processing unit (GPU) chipset.
Basic Example: Displaying All Video Card Details
You can run this command directly to see a list of all video controllers and their key properties.
@ECHO OFF
ECHO --- Querying Video Controller Details ---
ECHO.
WMIC PATH Win32_VideoController GET Name, DriverVersion, AdapterRAM
The output from WMIC is a table listing each detected video card.
--- Querying Video Controller Details ---
AdapterRAM DriverVersion Name
2147483648 31.0.15.2824 NVIDIA GeForce RTX 3080
AdapterRAM is in bytes. 2147483648 bytes is 2 GB (a common value for shared system memory on integrated graphics, even if a discrete card is present).
How to Capture the Information in a Script
To use this data, you should have WMIC format the output as CSV and then parse it with a FOR /F loop. This is the most reliable way to handle the model name, which will contain spaces.
@ECHO OFF
SETLOCAL
ECHO --- Capturing a List of All Video Cards ---
ECHO.
REM 'skip=1' ignores the header. 'tokens=2-4' grabs the three data columns.
FOR /F "skip=1 tokens=2,3,4 delims=," %%A IN (
'WMIC PATH Win32_VideoController GET AdapterRAM,DriverVersion,Name /FORMAT:CSV'
) DO (
ECHO Found Video Card:
ECHO Name: "%%~C"
ECHO Driver Version: "%%~B"
ECHO Adapter RAM: "%%~A" bytes
ECHO.
)
ENDLOCAL
The ~ modifier (%%~A) is used to remove the quotes that the CSV format adds.
How the WMIC Method Works
The WMIC command is an interface to the WMI service. It queries the Win32_VideoController class, which represents a physical video adapter. WMI reads this information directly from the Windows Plug and Play manager and the installed device driver, making it an authoritative source for hardware details.
Common Pitfalls and How to Solve Them
Problem: The System Has Multiple Video Cards
Many modern desktops and laptops have two GPUs: a power-saving integrated one (e.g., Intel HD Graphics) and a high-performance discrete one (e.g., NVIDIA or AMD). The WMIC command will list all of them.
Solution: This is the desired behavior for an inventory script. The FOR /F loop in the example script is designed to handle this correctly, iterating through each video card and reporting on it individually.
Problem: The Driver is Generic (e.g., "Microsoft Basic Display Adapter")
If you see this as the Name, it means Windows does not have the correct, manufacturer-specific driver installed. The system is using a fallback driver with limited capabilities.
Solution: This is not a script error but a system configuration issue. The solution is to install the latest drivers from the manufacturer (NVIDIA, AMD, or Intel). Your script can be designed to detect this generic name as an error condition.
Practical Example: A Full Display Hardware Report
This script creates a detailed report of the display hardware, including the video card(s) and the current resolution of the primary monitor.
@ECHO OFF
SETLOCAL
SET "ReportFile=%USERPROFILE%\Desktop\Display_Hardware_Report.txt"
ECHO --- Display Hardware Inventory Script ---
ECHO Creating report at: "%ReportFile%"
(
ECHO Display Hardware Report for: %COMPUTERNAME%
ECHO Generated on: %DATE% at %TIME%
ECHO ------------------------------------
) > "%ReportFile%"
REM --- Get Video Card(s) Info ---
(
ECHO.
ECHO --- INSTALLED VIDEO CONTROLLERS ---
) >> "%ReportFile%"
WMIC PATH Win32_VideoController GET Name,DriverVersion,AdapterRAM,Status /FORMAT:LIST >> "%ReportFile%"
REM --- Get Monitor Info ---
(
ECHO.
ECHO --- CONNECTED MONITORS ---
) >> "%ReportFile%"
WMIC PATH Win32_DesktopMonitor GET Name,ScreenWidth,ScreenHeight /FORMAT:LIST >> "%ReportFile%"
ECHO.
ECHO [SUCCESS] Report created.
START "" "%ReportFile%"
ENDLOCAL
This example uses /FORMAT:LIST which is another script-friendly format that is very easy to read in a log file.
Conclusion
The WMIC PATH Win32_VideoController command is the standard, built-in method for retrieving detailed information about the graphics hardware from a batch script.
Key takeaways:
- Use
WMIC PATH Win32_VideoController GET <Properties>to query video card details. - For scripting, always use a machine-readable format like
/FORMAT:CSVor/FORMAT:LISTto make parsing reliable. - The command will list all installed video controllers, including both integrated and discrete GPUs.
- Use a
FOR /Floop to capture and process the information for each adapter found.