- @echo off
- :s
- setlocal
- set/p a=请输入1025到65535之间的数字:
- set/a "b=%a%"2>nul||goto:err
- if %b% lss 1025 goto:err
- if %b% gtr 65535 goto:err
- netstat -aon|find ":%b%">nul 2>nul&&goto:err
- reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp" /v PortNumber /t REG_DWORD /d %b% /f>nul
- reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v PortNumber /t REG_DWORD /d %b% /f>nul
- pause&exit
- :err
- echo 输入的 "%a%" 出错
- pause&endlocal&goto:s
复制代码
[ 本帖最后由 hanyeguxing 于 2011-2-8 12:26 编辑 ] |