Jerold
Wed Apr 06 13:26:30 CDT 2005
On Wed, 6 Apr 2005 10:11:19 -0700, "William Fields" <Bill_Fields@azb.uscourts.gov> wrote:
>Hello,
>
>Is there a way to launch an application at login depending on the current
>hardware profile?
>
>For example, when using the "Docked" profile, I'd like to launch a certain
>.EXE. But when I'm not booting up under the Docked profile, the .EXE would
>not run.
>
>If not natively supported, could it be something that's scripted?
>
>Thanks.
Whatch out for line wrap.
REG.EXE is built into Windows XP and later, and available in Windows 2000 by installing the Support Tools from the CD-ROM.
call HardwareProfile Name
Where Name is the name of an environment variable that will be set to the friendlyName of the booted profile.
See tip 3790 in the 'Tips & Tricks' at
http://www.jsifaq.com
@echo off
if {%1}=={} @echo Syntax: HardwareProfile 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
)
@echo %FN%
endlocal&set %1=%FN%
Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com