Using REG.EXE, built into Windows XP, Windows Server 2003, and later, or installed on Windows 2000 from the Support Tools on the operating system CD-ROM, I have scripted HardwareProfile.bat to return the active hardware profile key number and friendly name.

The syntax for using HardwareProfile.bat is:

call HardwareProfile Number FriendlyName

Where:

<b>Number</b>       is a <a href="/article/jsifaq/jsi-tip-5535-how-can-i-cause-a-called-batch-file-to-return-a-call-directed-environment-variable-.aspx">call directed environment variable</a> that will contain the <key number> of the active profile,
             as in <b>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\IDConfigDB\Hardware Profiles\<key number></b>.

<b>FriendlyName</b> is a <a href="/article/jsifaq/jsi-tip-5535-how-can-i-cause-a-called-batch-file-to-return-a-call-directed-environment-variable-.aspx">call directed environment variable</a> that will contain the friendly name of the active profile.
HardwareProfile.bat contains:
@echo off
if \{%1\}==\{\} @echo Syntax: HardwareProfile Number FriendlyName&goto :EOF
setlocal
<font size="1">for /f "Tokens=2*" %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\IDConfigDB" /V CurrentConfig^|FIND "REG_DWORD"') do (</font>
 set /a profile=%%b
)
set /a profile=%profile% + 10000
set profile=%profile:~1%
<font size="1">for /f "Tokens=2*" %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\IDConfigDB\Hardware Profiles\%profile%" /V FriendlyName^|Find "REG_SZ"') do (</font>
 set FN=%%b
)
endlocal&set %1=%profile%&set %2=%FN%