cls
@color 0A
@mode con cols=80 lines=32
@title ★修改默认3389端口★
@echo off
echo ===============================================================================
echo ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
echo ※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
echo ※                               3389.bat v1.0                                ※
echo ※                                                                                     ※
echo ※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
echo ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
echo                            %date%   %time%
echo ===============================================================================
echo 用途:通过修改注册表,修改默认3389端口
echo ===============================================================================
echo 环境:Windows Server 2003 Enterprise SP2
echo ===============================================================================
goto :3389-1
:3389-1
::***********************************************************
::导出3389端口默认注册表
reg export "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server"  c:\3389.reg
goto :3389-2
:3389-2
set /p port1=请输入你要修改的3389端口:
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v portnumber /d %port1% /f
set /p port2=请输入你要修改的3389端口:
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\wds\rdpwd\tds\tcp" /v portnumber /d %port1% /f
if %port1%==%port2% (echo 修改成功!!!) else (echo 两次输入不一致,请重新输入。&goto 3389-2)
goto :QUIT
:QUIT
echo ________________________________________________________
echo.
echo For more informations,please mail to : echo________________________________________________________
echo            [Press any key to quit]
echo ________________________________________________________
echo.
pause >nul
exit