Remote Desktop port Modification batch processing

Source: Internet
Author: User

@echo off
@echo [Remote Desktop port modifier V1.0 update Time 2015/06/10]
TITLE Remote Desktop Port modification Program

Cls
MODE con:cols=68 lines=20
:: The mode statement is the width and height of the set form

SetLocal enabledelayedexpansion
set/p d= "Please enter a new Remote Desktop port:"
Echo will modify the remote Desktop port to [%d%], so be sure to keep that port number in mind.
echo if enabled [System Firewall]--[IPSEC policy]--[TCP/IP Filter] or
echo Other protection software allows the [%d%] port to pass. Otherwise, there will be a problem.
Echo Press any key to continue operation ...
Pause>nul
Set Str=0123456789abcdef
: Loop
set/a y=%d%%%16
set/a D=%D%%/16
Set y=! str:~%y%,1!
Set e=%y%%e%
If%d% geq 1 goto Loop
Echo------------------------------------------------------
Echo is creating the registry file.
Ping-n 2 127.0.1>nul
echo Windows Registry Editor Version 5.00> C:\Remote.reg
echo [hkey_local_machine\system\currentcontrolset\control\terminal server\wds\rdpwd\tds\tcp]>> c \ Remote.reg
echo "PortNumber" =dword:0000%e%>> C:\Remote.reg
echo [hkey_local_machine\system\currentcontrolset\control\terminal server\winstations\rdp-tcp]>> c \ Remote.reg
echo "PortNumber" =dword:0000%e%>> C:\Remote.reg
ECHO is importing the registry file to change the system default settings.
Ping-n 2 127.0.1>nul
REGEDIT/S C:\Remote.reg
del c:\Remote.reg && echo temp file has been deleted.
Ping-n 2 127.0.1>nul
Echo------------------------------------------------------
Echo again reminds you that the port is open.
The echo port has been modified and will not take effect until the server is restarted.
Echo Press any key to exit ...
Pause>nul


Remote Desktop port Modification batch processing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.