KeyRoutines
TriggerFreetrigger.device.connected

Run a routine when you plug in a USB or Bluetooth device

Device connected starts a routine when a USB device or a paired Bluetooth device connects. Name one device, or leave the name empty to react to any.

How it works

  • Type the device's name as Windows shows it, part of it, or its device id; leave it empty for any device.
  • An advanced option limits it to USB, Bluetooth, or both.
  • It fires once per physical device after things settle for a second, so a device with several parts doesn't fire several times.
  • Devices already connected when the routine was turned on don't fire.
  • The routine gets the device's name, id and kind.

Routines that use it

Dock in, desk mode

When your laptop dock connects, Apply layout puts your windows back and Set default audio device picks your speakers.

Controller on, game launcher up

When your controller connects over Bluetooth, Open app starts your game launcher.

Drive in, backup runs

When your USB backup drive connects, Zip files packs your documents and Move or copy file puts the zip on it.

Settings

SettingWhat it does
DeviceThe device: its name as Windows shows it (part of it is enough), or its device id. Empty: any device.
KindadvancedOnly USB devices, only Bluetooth devices, or both.

Good to know

  • Hubs and devices built into the PC are left out.

Questions

Can Windows run a program when I plug in a USB drive?
With KeyRoutines it can. Use Device connected with the drive's name and add an Open app or Move or copy file step.
Why didn't it fire for a device that was already plugged in?
It reacts to new connections only. A device that was connected when the routine was turned on counts as the starting point.

Pairs well with

Build this routine in KeyRoutines

Free from the Microsoft Store for Windows 11 and 10. Pro is a one-time upgrade.