- @echo off
- color 0D
- MODE con: COLS=71 LINES=25
- title 远程桌面端口修改程序
- :getport
- set /p getport=请输入需设定远程桌面的端口号:
- if /I "%getport%"=="" Goto noset else goto setport
-
- :setport
- reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Terminal Server\Wds\rdpwd\Tds\tcp" /v "PortNumber" /t REG_DWORD /d "%getport%" /f >nul
- reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Terminal Server\WinStations\RDP-Tcp" /v "PortNumber" /t REG_DWORD /d "%getport%" /f >nul
- reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Control\Terminal Server\Wds\rdpwd\Tds\tcp" /v "PortNumber" /t REG_DWORD /d "%getport%" /f >nul
- reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Control\Terminal Server\WinStations\RDP-Tcp" /v "PortNumber" /t REG_DWORD /d "%getport%" /f >nul
- reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp" /v "PortNumber" /t REG_DWORD /d "%getport%" /f >nul
- reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v "PortNumber" /t REG_DWORD /d "%getport%" /f >nul
- echo 远程桌面端口已设置为:%getport%,请牢记,按任意键退出!
- pause >nul
- goto end
-
- :noset
- echo 输入值为空,端口未改变,按任意键退出!
- pause >nul
- goto end
复制代码 这是个我做的改远程桌面端口的程序,我想在- :getport
- set /p getport=请输入需设定远程桌面的端口号:
复制代码 前显示出系统当前的远程桌面的端口 |