How to fix a Barcode scanner not working on CF-H2 Toughbook laptop

The Barcode module on the CF-H2 is hard-coded to use COM3.  In some cases, this port is occupied by another device, which are soft assignment to COM3 (can be re-assigned to another port).  In those cases, the Barcode scanner does not work.  Here is a way to address this issue via a script/batch.