When a program says a port is already in use, you need to know who has it. netstat has the port and the process ID, and tasklist turns the ID into a name.
netstat -ano | findstr :8080
tasklist /fi "PID eq 4321"
-a shows all connections and the ports that are listening, -n keeps addresses and ports numeric so nothing waits on name lookups, and -o adds the process ID. The findstr in the example filters the output to one port, and the last column of the matching line is the PID.
Then ask tasklist for that PID. Microsoft’s reference lists PID as a valid filter name, so the /fi filter above prints the one process. Add /svc to see which services run inside it, which helps when the process is a generic svchost.exe.
If you prefer to let netstat name the program, netstat -b shows the executable behind each connection, but Microsoft warns it can be time consuming and fails without sufficient permissions.
The caveat is that the output is a snapshot. Connections come and go, and a PID can be reused after a process ends, so look up the PID right after you read it. Reading the port from the end of a line also deserves care, since findstr :80 matches port 8080 too. Search with the full port number and check the local address column.
Further reading: Microsoft Learn: netstat, Microsoft Learn: tasklist