适用于: Windows 10, Windows 8.1, Windows 8, Windows Server 2019, Windows Server 2016, Windows Server 2012 R2, Windows Server 2008 R2

When you connect to a computer (either a Windows client or Windows Server) through the Remote Desktop client, the Remote Desktop feature on your computer "hears" the connection request through a defined listening port (3389 by default). You can change that listening port on Windows computers by modifying the registry.

当你连接到一个远程的Windows系统时,这个系统会启动监听一个端口(默认是3389),你可以使用下面的方法更换监听的端口(这会一定程度上提升安全性)。

  1. Start the registry editor. (Type regedit in the Search box.) 启动注册表编辑器(运行——regedit,或使用搜索框搜索regedit)
  2. Navigate to the following registry subkey: 查找到下面的键值 HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp
  3. Find PortNumber 在右侧找到 PortNumber
  4. Click Edit > Modify, and then click Decimal. 双击可以修改
  5. Type the new port number, and then click OK. 选择十进制以后,修改为你要变更的端口。
  6. Close the registry editor, and restart your computer. 关闭注册表编辑器,重新启动电脑。

The next time you connect to this computer by using the Remote Desktop connection, you must type the new port. If you're using a firewall, make sure to configure your firewall to permit connections to the new port number.

下一次连接时,即可使用新的端口。如果你启用了防火墙,请不要忘记需要将新的端口放行。