17

I need to get a text output with the video card / GPU model, using any tool existing in all Windows versions from XP onwards (unlikely, I haven't found anything yet) or using any small command line third party tool.

Any ideas?

1
  • 1
    dxdiag has command line options to output to txt or xml file, it just won't print to screen. You could get the gnuwin32 tools and then cat the file after you create it with dxdiag (and even grep for the lines you care about).
    – MaQleod
    Mar 2, 2014 at 3:23

5 Answers 5

26
wmic path win32_VideoController get name 

does the job concisely from commmand line. Thanks to Vlastimil Ovčáčík's answer above but not sure why its so verbose.

4
  • 1
    The other answer removes the "Name" line from the output.
    – DavidPostill
    Mar 25, 2015 at 20:38
  • Indeed it does, thanks, @DavidPostill . Still, its quite a complicated approach.
    – oche
    Mar 25, 2015 at 20:44
  • Not so complicated when you learn how for works. It is very powerful and great for parsing lines of text ;)
    – DavidPostill
    Mar 25, 2015 at 20:48
  • wmic path win32_VideoController get driverVersion will show driver version
    – nwgat
    Dec 20, 2016 at 3:41
7

Run from batch:

@echo off
for /F "tokens=* skip=1" %%n in ('WMIC path Win32_VideoController get Name ^| findstr "."') do set GPU_NAME=%%n
echo %GPU_NAME%
4
  • Hi! That looks exactly like I'm looking for, but I can't get it to work on my PC, I'm no expert in batch, could you help out? I get this response: C:\Users\user\Desktop>gpu n) was unexpected at this time. C:\Users\user\Desktop>for /F "tokens=* skip=1" n) C:\Users\user\Desktop> Mar 2, 2014 at 18:42
  • @user2723297, it wasn't written for batch, but to be directly pasted in command line. Let me edit the answer to prevent misunderstanding. Mar 3, 2014 at 15:01
  • Thanks, still getting this message when running straight from the command prompt "%%n was unexpected at this time." Mar 3, 2014 at 22:34
  • @user2723297, as the answer states, it is supposed to be run from batch file. Also stackoverflow.com/questions/14509652/… Mar 4, 2014 at 9:45
5
  • Copy this and save to your desktop as videoCardScript.ps1
  • Click Start then type powershell and then press enter
  • type cd ~\Desktop then press enter
  • type videoCardScript.ps1 then press enter
  • note: if you receive an error mentioning ...cannot be loaded because running scripts is disabled on this system. you may need to change your execution policy with the following command in powershell: Set-ExecutionPolicy unrestricted.
  • ****Ensure you do the following command when complete to maintain the security of your system:** Set-ExecutionPolicy restricted

    dxdiag /x dxoutput.xml | Out-Null  #Out-Null here ensures the process here has been created before proceeding
    [xml]$xmldata = get-content "dxoutput.xml"
    $xmldata.DxDiag.DisplayDevices.DisplayDevice| % {
        $name=$_.CardName
        $manu=$_.Manufacturer
        $chip=$_.ChipType
        $type=$_.OutputType
        $version=$_.DriverVersion
        write-host "Name: `t`t`t $name"
        write-host "Manufacturer: `t`t $manu"
        write-host "Chip Type: `t`t $chip"
        write-host "Output Type: `t`t $type"
        write-host "Driver Version: `t $version"
        }
    del dxoutput.xml
    

If you're interested in getting more info you can comment out the del dxoutput.xml command by adding a # in front of it. You can then look at the contents of the xml file that's saved to your desktop and can adjust accordingly. If you want to remove some info in the script you can always comment out those specific lines or remove them entirely.

PS- you may see multiple of the same cards. There's a reason I have the Output Type included here: a card will show multiples based on how many outputs it can support. In my case mine shows DVI (self explanatory) and HD15 (which is VGA).

PSS- I ran this on a Windows 8 machine. There's a possibility you may need to install powershell on the XP machines. They'll need to have Service Pack 3 installed and then you can install Powershell from here: http://support.microsoft.com/kb/968929 (Windows Management Framework (Windows PowerShell 2.0, WinRM 2.0, and BITS 4.0))

0
1

copy this code into a .VBS file and run it with cscript.exe:

strComputer = "." 
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") 
Set colItems = objWMIService.ExecQuery( _
    "SELECT * FROM Win32_VideoController",,48) 
For Each objItem in colItems 
    Wscript.Echo "-----------------------------------"
    Wscript.Echo "Win32_VideoController instance"
    Wscript.Echo "-----------------------------------"
    Wscript.Echo "Caption: " & objItem.Caption
Next

Here is the output of my Dell Laptop:

-----------------------------------
Win32_VideoController instance
-----------------------------------
Caption: Intel(R) HD Graphics 4000
-----------------------------------
Win32_VideoController instance
-----------------------------------
Caption: AMD Radeon HD 7700M Series
0

Run in Command Prompt:

wmic path win32_VideoController get /all /format:htable >> c:\VGA.html
4
  • 3
    Please explain what the command does
    – Ramhound
    Aug 8, 2015 at 16:15
  • Can you explain what this code does and how it addresses the problem given by the OP? Unexplained code can appear untrusted and dangerous to users.
    – bwDraco
    Aug 8, 2015 at 21:49
  • It get Video Card information and save it as html format in C Drive named vga.html
    – S.Alizadeh
    Aug 9, 2015 at 18:09
  • This command works, although you don't need to (or can't due to perms) set c:\VGA.html from non admin user. Instead just change the path to VGA.html to dump into the user dir. I agree though it's purpose should be explained in the question rather than down here in comment.
    – dhaupin
    Nov 30, 2015 at 14:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .