Windows 修改远程端口脚本

        这个是我购买三丰云服务器的时候,看到桌面的一个bat脚本,感觉有用,是通过脚本去修改服务器的远程端口。

@echo off
color f0
echo 修改远程桌面3389端口(支持Windows 2003 2008 2008R2 2012 2012R2 7 8 10 )
echo 自动添加防火墙规则
echo %date% %time%
echo ARK
set /p c= 请输入新的端口:
if "%c%"=="" goto end
goto edit
:edit
netsh advfirewall firewall add rule name="Remote PortNumber" dir=in action=allow protocol=TCP localport="%c%"
netsh advfirewall firewall add rule name="Remote PortNumber" dir=in action=allow protocol=TCP localport="%c%"
reg add "HKLMSYSTEMCurrentControlSetControlTerminal ServerWdsrdpwdTdstcp" /v PortNumber /t reg_dword /d %c% /f
reg add "HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTerminal ServerWinStationsRDP-Tcp" /v PortNumber /t reg_dword /d %c% /f
echo 修改成功
echo 重启后生效,按任意键重启
pause
shutdown /r /t 0
exit
:end
echo 修改失败
pause
@echo off
color f0
echo 修改远程桌面3389端口(支持Windows 2003 2008 2008R2 2012 2012R2 7 8 10 )
echo 自动添加防火墙规则
echo %date%   %time%
echo    ARK
set /p c= 请输入新的端口:
if "%c%"=="" goto end
goto edit
:edit
netsh advfirewall firewall add rule name="Remote PortNumber" dir=in action=allow protocol=TCP localport="%c%"
netsh advfirewall firewall add rule name="Remote PortNumber" dir=in action=allow protocol=TCP localport="%c%"
reg add "HKLMSYSTEMCurrentControlSetControlTerminal ServerWdsrdpwdTdstcp" /v PortNumber /t reg_dword /d %c% /f
reg add "HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTerminal ServerWinStationsRDP-Tcp" /v PortNumber /t reg_dword /d %c% /f
echo 修改成功
echo 重启后生效,按任意键重启
pause
shutdown /r /t 0
exit
:end
echo 修改失败
pause
@echo off color f0 echo 修改远程桌面3389端口(支持Windows 2003 2008 2008R2 2012 2012R2 7 8 10 ) echo 自动添加防火墙规则 echo %date% %time% echo ARK set /p c= 请输入新的端口: if "%c%"=="" goto end goto edit :edit netsh advfirewall firewall add rule name="Remote PortNumber" dir=in action=allow protocol=TCP localport="%c%" netsh advfirewall firewall add rule name="Remote PortNumber" dir=in action=allow protocol=TCP localport="%c%" reg add "HKLMSYSTEMCurrentControlSetControlTerminal ServerWdsrdpwdTdstcp" /v PortNumber /t reg_dword /d %c% /f reg add "HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTerminal ServerWinStationsRDP-Tcp" /v PortNumber /t reg_dword /d %c% /f echo 修改成功 echo 重启后生效,按任意键重启 pause shutdown /r /t 0 exit :end echo 修改失败 pause
© 版权声明
THE END
喜欢就支持一下吧
点赞11 分享
No one can change another. But one can be the reason for another to change.
没人能改变另一个人,但是某个人能成为一个人改变的原因
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片快捷回复

    暂无评论内容