How can I get a list of available COM ports on my PC?

How can I get a list of available COM ports on my PC?

Applies to: Docklight Scripting (all versions), Article ID: dl_faq060

Use DL.GetEnvironment(“DOCKLIGHT_PORTLIST”) to obtain a list of COM ports available on your PC, including its description / “friendly name”.

An example could look like this:
DL.AddComment DL.GetEnvironment(“DOCKLIGHT_PORTLIST”)

COM2 (com0com – serial port emulator)
COM6 (Standard Serial over Bluetooth link)
COM7 (USB Serial Port)
COM8 (USB Serial Port)
COM9 (USB Serial Port)
COM13 (Standard Serial over Bluetooth link)
COM15 (Standard Serial over Bluetooth link)
COM30 (com0com – serial port emulator)
COM31 (com0com – serial port emulator)

Docklight Scripting Manual – GetEnvironment method