Com port issues - two boards

I have two Arduino UNOs. When I connect one (Board1) to the PC via USB, it doesn't Windows Device Manager doesn't display Arduino on COM 4 it just says
USB Serial Device (COM4),

but Arduino shows it's using COM4 . I can upload a sketch to that board and it runs. The Port menu in Tools shows COM4 (Arduino Uno)

With the other board (Board 2), which was running previously using COM10, when I upload the sketch, it immediately comes up with

java.io.IOException: jssc.SerialPortException: Port name - COM4; Method name - setEventsMask(); Exception type - Can't set mask.
at processing.app.Serial.dispose(Serial.java:171)
at processing.app.SerialMonitor.close(SerialMonitor.java:147)
at processing.app.AbstractMonitor.suspend(AbstractMonitor.java:113)
at processing.app.Editor$UploadHandler.run(Editor.java:2055)
at java.lang.Thread.run(Thread.java:748)
Caused by: jssc.SerialPortException: Port name - COM4; Method name - setEventsMask(); Exception type - Can't set mask.
at jssc.SerialPort.setEventsMask(SerialPort.java:279)
at jssc.SerialPort.removeEventListener(SerialPort.java:1064)
at jssc.SerialPort.closePort(SerialPort.java:1090)
at processing.app.Serial.dispose(Serial.java:168)
... 4 more

The Port menu in Tools says COM4 - no mention of Arduino Uno.
I have re-installed Arduino twice. This all began happening after I had left Board 2 connected to USB for several days. I have rebooted the PC (Windows 10) several times and reset the boards.

Any help would be gratefully appreciated.
Thanks

PS I have disconnected everything from USB except the keyboard and mouse.

It's not clear what you are doing. Start an Arduino IDE for each board, then select the desired port in each IDE.

If you want to use COM10 and the IDE complains about COM4 then you failed to switch to COM10.

Thanks for your quick reply. It looks as if one board has failed. I don't know why it's changed to using COM4.

Best wishes

Open Device Manager and under Ports section, you will find your board's COM port number (Example: COM1, COM2, etc.). You then need to select THAT port number on your Arduino IDE by going to Tools > Port. Then you should be able to flash your code into the board. After you are done flashing, Unplug it and connect the other board to the SAME USB PORT, and try flashing something.

If it still fails, try reinstalling necessary drivers. Or maybe one of the boards have gone bad.

That's all I can say based on what you have provided. Good Luck!