如下
@echo off
chcp 65001
color 0a
echo compile by zxc
title #修改Windows 2003/2008/win10远程桌面服务端口号#
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp" /v PortNumber /t reg_dword /d 8084 /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v PortNumber /t reg_dword /d 8084 /f
::netsh firewall set opmode mode = enable
::netsh firewall set portopening all 3389 remote-pre enable
::netsh firewall set portopening all 8084 remote enable
::防火墙相关,看情况可能无需修改
netsh advfirewall firewall add rule name="Open Port 80" dir=in action=allow protocol=TCP localport=80
netsh advfirewall firewall add rule name="Open Port 8084" dir=in action=allow protocol=TCP localport=8084
netsh advfirewall firewall add rule name="Open Port 8084" dir=out action=allow protocol=TCP localport=8084
::reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t reg_dword /d 1 /f
::1为禁用,0为运行 远程桌面
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t reg_dword /d 0 /f
echo 正在自动重新启动电脑以便端口生效!
pause
::exit