Windows
Windows
Knowledge, configurations, guides, commands and everything helpful when using Windows.
Commands
- Get rid of app which occupies given port
- Check app PID
netstat -ano | findstr ":<port>"
netstat -ano | findstr ":8080"
- Find what’s the app
tasklist /fi "pid eq <pid>"
tasklist /fi "pid eq 22216"
- Kill process
taskkill /PID <pid> /F
taskkill /PID 22216 /F
- Check app PID
- Other port commands
- To see current state of ports run:
netsh int ip show excludedportrange protocol=tcp
- To add port 4200 to exclusions, run:
netsh int ipv4 add excludedportrange protocol=tcp startport=3306 numberofports=1
- To see current state of ports run:
Workarounds for port-related problems
When ports are not available despite nothing using them.
Lecture
At first, it’d be worth to read this:
- https://stackoverflow.com/a/62359555/10699128
- https://github.com/docker/for-win/issues/3171#issuecomment-554587817
- https://learn.microsoft.com/en-us/troubleshoot/windows-server/networking/default-dynamic-port-range-tcpip-chang
- https://github.com/docker/for-win/issues/3171#issuecomment-1895729704
- https://medium.com/@sevenall/completely-solve-the-problem-of-docker-containers-not-starting-or-running-on-windows-10-due-to-port-57f16ed6143
- https://github.com/docker/for-win/issues/3171#issuecomment-1895729704
- https://learn.microsoft.com/en-us/troubleshoot/windows-server/networking/default-dynamic-port-range-tcpip-chang
- https://github.com/docker/for-win/issues/3171#issuecomment-554587817
Workarounds / solution attempts
1
restart-service nhs
Run CMD/PowerShell as Admin and run:
1
2
net stop winnat
net start winnat
However, this may make WSL2 unable to connect to the Web.
Solution from Web, not verified yet:
1
2
3
4
netsh winsock reset
netsh int ip reset all
netsh winhttp reset proxy
ipconfig /flushdns
Source: https://github.com/microsoft/WSL/issues/3438#issuecomment-410518578
Hyper-V
Draft notes:
1
2
3
4
5
6
7
8
9
10
11
12
13
ROG-STRIX-G18-V
"Windows 11 VM"
VMConnect.exe "ROG-STRIX-G18-V" "Windows 11 VM" /edit
Set-VMVideo -VMName "Windows 11 VM" -HorizontalResolution 2560 -VerticalResolution 1440 -ResolutionType Single
Get-VMHost | fl -Property EnableEnhancedSessionMode
Set-VMhost -EnableEnhancedSessionMode $True
%APPDATA%\Microsoft\Windows\Hyper-V\Client\1.0