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:

Number       is a call directed environment variable that will contain the <key number> of the active profile,                                           as in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\IDConfigDB\Hardware Profiles\<key number>.                              FriendlyName is a call directed environment variable 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                              for /f "Tokens=2*" %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\IDConfigDB" /V CurrentConfig^|FIND "REG_DWORD"') do (                               set /a profile=%%b                              )                              set /a profile=%profile% + 10000                              set profile=%profile:~1%                              for /f "Tokens=2*" %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\IDConfigDB\Hardware Profiles\%profile%" /V FriendlyName^|Find "REG_SZ"') do (                               set FN=%%b                              )                              endlocal&set %1=%profile%&set %2=%FN%