Delete COM ports currently in use on Windows 10 using a batch script.
Delete COM ports currently in use on Windows 10 using a batch script.
Hey! It sounds like you're dealing with a lot of devices needing virtual COM ports, which can get tedious. You're looking for a solution to automatically remove them in bulk. Let me know if you'd like help finding tools or methods for that.
You have around a dozen Arduino boards, mostly running version 9.14 or newer. None of them seem to be using older firmware versions.
In PowerShell: retrieve - wmiobject - Query "select * from win32_systemdriver where caption like `"USB Serial Port %` "" | ForEach { $_ . StopService () $_ . Delete () } I haven't tested this and offer no guarantees. Actually, the worst it could do is fixed by a reboot."
Windows faces issues because it doesn't reuse COM ports unless devices report identical identifiers, meaning each connected device can have a distinct COM port VID/PID. These values are fully adjustable based on the hardware I use, which is why I encounter the same challenge at work with many embedded systems. Linux handles serial ports more smoothly. Serial numbers are reassigned to the pool when a device disconnects, and they clearly distinguish between USB and hardware serial connections (such as ttyUSB versus ttyS).