Sam Hooke

These are rough notes from whatever I was working on, interested in or thinking about at the time. They vary greatly in quality and length, but prove useful to me, and hopefully to you too!

Removing unused COM ports from Windows

Through Device Manager in Windows you can view which COM port has been assigned to which device. Each new device gets assigned the next COM port number, starting from COM1. If over the years you have connected many different devices which are assigned COM ports, this is not forgotten:

Screenshot of Windows 7 Device Manager with hidden devices hidden
Hidden devices hidden

It may be desirable to unassigned COM ports from devices you no longer use. This way, when you connect your new device it might get assigned COM2, for instant, rather than COM46.

To do so, first you must set the user variable devmgr_show_nonpresent_devices to 1. One way of doing this in Windows 7 is to open up “Environment Variables”, click “New…” under user variables, and then add the variable.

Next, you can go to Device Manager, select “view”, and then “Show hidden devices”. Now when expanding the “Ports” category it will show all devices which have been assigned a COM port, including those not currently connected.

Screenshot of Windows 7 Device Manager with hidden devices unhidden
Hidden devices unhidden

To unassign a COM port, right-click and select “Uninstall”.

<< Previous: Attach shell to running Python process
Next: Lightweight Python SIP library >>