rem @ECHO OFF
set OldPort=COM5
set NewPort=COM4
set HW_ID=USB\VID_0613^&PID_2000
set HW_NAME=ITHACA_M280P
set PDO_NAME=\Device\USBPDO-8


devcon disable "%HW_ID%"

Reg Add "HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM" /V %PDO_NAME% /T REG_SZ /D %NewPort% /f

Reg Add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\%HW_ID%\%HW_NAME%\Device Parameters" /V PortName /T REG_SZ /D "%NewPort%" /f

Reg Add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Enum\%HW_ID%\%HW_NAME%\Device Parameters" /V PortName /T REG_SZ /D "%NewPort%" /f

Reg Add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\%HW_ID%\%HW_NAME%\Device Parameters" /V PortName /T REG_SZ /D "%NewPort%" /f

devcon enable "%HW_ID%"

pause.