Run on startup, but only in this hardware profile?

W

William Fields

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.

--
William Fields
MCSD - Microsoft Visual FoxPro
US Bankruptcy Court
Phoenix, AZ

"Beer is proof that God loves us
and wants us to be happy."

- Benjamin Franklin
 
J

Jerold Schulman

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top