How to get connected USB device list from windows by using python or cmd
问题 I need to get connected USB device list from windows by using python or cmd. for python i'm trying this. import win32com.client def get_usb_device(): try: usb_list = [] wmi = win32com.client.GetObject("winmgmts:") for usb in wmi.InstancesOf("Win32_USBHub"): print(usb.DeviceID) print(usb.description) usb_list.append(usb.description) print(usb_list) return usb_list except Exception as error: print('error', error) get_usb_device() as a result i get this: ['USB Root Hub (USB 3.0)', 'USB Composite