站内搜索

一键修改远程桌面端口号 bat 批处理

  Windows 远程桌面服务默认使用的是 3389 端口,该端口常常被定义为高危端口而被要求关闭。关闭之后若无法使用远程桌面,此时可修改默认的 3389 端口为其它端口。手动修改可能有点麻烦(需操作注册表),可通过下面的 BAT 批处理程序直接完成修改。

  使用方法:将以下代码复制保存为“一键修改远程桌面端口号.bat”。右击“以管理员身份运行”即可。

@echo off
color 0a
title  修改 Windows 远程桌面端口号 by xiakeshu.com
echo.
echo   输入您要更改的远程桌面端口号,范围:1024-65535,不能与其他端口冲突!
echo.
set /p port=请输入端口号:
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp" /v PortNumber /t reg_dword /d %port% /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v PortNumber /t reg_dword /d %port% /f
netsh advfirewall firewall set opmode mode = enable
netsh advfirewall firewall set portopening all 80 web enable
netsh advfirewall firewall set portopening all 3389 remote-pre enable
netsh advfirewall firewall set portopening all %port% remote enable
echo.
echo   重新启动远程桌面……
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t reg_dword /d 1 /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t reg_dword /d 0 /f
echo.
echo   下面开始重新启动电脑以生效,请选择启动方式:
echo   选择1手动重新启动
echo   选择2自动重新启动
set /p select=请您选择 [ 1 或 2 ]:
if  "%select%"=="1"  goto A
if  "%select%"=="2"  goto B
pause
exit
:A
echo   退出,请手动重新启动电脑
pause
exit
:B
shutdown -r -t 1
pause
exit
  • 驱动家园 说:

    http://www.drv123.com 驱动家园到此学习!

    2023-11-22 08:39:47 Google Chrome 86 Windows 10回复
  • enverahep 说:

    The probabilities of chemotherapy induced amenorrhea were 7 how to buy priligy in usa

    2024-11-10 21:11:21 Google Chrome 124 Windows 10回复
  • misoprostol 200 mcg online 说:

    Some other interactions, which like Valerian root and high blood pressure medication, are not recommended at all, are Medicine for any type of infection including human immunodeficiency virus, malaria, or tuberculosis Anti anxiety or antidepressants can you buy cheap cytotec Zysten und Polypen

    2024-12-5 18:31:37 Google Chrome 124 Windows 10回复
    Copyright © XiakeShu.com 版权所有 | 备案号:浙ICP备11004787号-12