Windows修改远程端口bat脚本
Last updated
2023-01-18 17:55:27
{"value":"### \u4e00\u952e\u4fee\u6539Windows\u8fdc\u7a0b\u7aef\u53e3 ##\n\n\u9996\u5148\uff0c\u65b0\u5efa\u8bb0\u4e8b\u672c\uff0c\u590d\u5236\u9ecf\u8d34\u4ee3\u7801\uff0c\u6587\u4ef6\u9009\u62e9\u53e6\u5b58\u4e3a\uff0c\u5e76\u4e14\u7f16\u7801\u65b9\u5f0f\u9009\u62e9ANSI\uff0c\u9ed8\u8ba4\u683c\u5f0fUTF-8\u4f1a\u51fa\u73b0\u4e2d\u6587\u4e71\u7801\u7684\u60c5\u51b5\u3002\n\n \u6587\u4ef6\u540d(N):xxx.bat\n \u4fdd\u5b58\u7c7b\u578b(T):\u6587\u672c\u6587\u6863(*.txt)\n \u7f16\u7801\uff1aANSI\n\n\u5e76\u628a\u6587\u4ef6\u683c\u5f0ftxt\u6587\u4ef6\u6539\u4e3abat\u6587\u4ef6\u3002\u70b9\u51fb\u8fd0\u884c\uff0c\u8f93\u5165\u9700\u8981\u4fee\u6539\u7684\u8fdc\u7a0b\u7aef\u53e3\u53f7,\u56de\u8f66\u786e\u5b9a\uff0c\u5f00\u59cb\u6267\u884c\u3002\u6700\u540e\u6309\u4efb\u610f\u952e\u91cd\u542f\u7cfb\u7edf\uff0c\u91cd\u542f\u5b8c\u6210\u540e\u5c31\u53ef\u4ee5\u7528\u65b0\u7684\u7aef\u53e3\u8fdc\u7a0b\u4e86\uff01\n\n\u4e0b\u9762\u662f\u5177\u4f53\u4ee3\u7801\uff1a\n\n @echo off\n \n color f0\n \n echo \u4fee\u6539\u8fdc\u7a0b\u684c\u97623389\u7aef\u53e3(\u652f\u6301Windows 2003 2008 2008R2 2012 2012R2 7 8 10 )\n \n echo \u81ea\u52a8\u6dfb\u52a0\u9632\u706b\u5899\u89c4\u5219\n \n echo %date% %time%\n \n set \/p c= \u8bf7\u8f93\u5165\u65b0\u7684\u7aef\u53e3:\n \n if \"%c%\"==\"\" goto end\n \n goto edit\n \n :edit\n \n netsh advfirewall firewall add rule name=\"Remote PortNumber(TCP-%c%)\" dir=in action=allow protocol=TCP localport=\"%c%\"\n \n reg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\Wds\\rdpwd\\Tds\\tcp\" \/v \"PortNumber\" \/t REG_DWORD \/d \"%c%\" \/f\n \n reg add \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\RDP-Tcp\" \/v \"PortNumber\" \/t REG_DWORD \/d \"%c%\" \/f\n \n echo \u4fee\u6539\u6210\u529f\n \n echo \u91cd\u542f\u540e\u751f\u6548\uff0c\u6309\u4efb\u610f\u952e\u91cd\u542f\n \n pause\n \n shutdown \/r \/t 0\n \n exit\n \n :end\n \n echo \u4fee\u6539\u5931\u8d25\n \n pause\n\n\n\u6700\u540e\uff0c\u4e00\u5b9a\u8981\u6ce8\u610f\u7684\u662f\uff0c\u6bcf\u6b21\u8fd0\u884c\u5de5\u5177\uff0c\u90fd\u4f1a\u5728\u7cfb\u7edf\u9632\u706b\u5899\u7684\u5185\u751f\u6210\u4e00\u6b21\u653e\u884c\u7684\u7aef\u53e3\u7684\u89c4\u5219\uff0c\u8bb0\u5f97\u53bb\u5220\u9664\u5165\u7ad9\u89c4\u5219\u4e2d\u591a\u4f59\u7684Remote PortNumber(TCP-xxx)\u653e\u884c\u7aef\u53e3\u89c4\u5219\u3002\u5220\u9664\u8fc7\u7a0b\u5982\u4e0b\uff1a\n\n\u7b2c\u4e00\u6b65\u627e\u5230\u6587\u4ef6\u8d44\u6e90\u7ba1\u7406\u5668\uff0c\u6216\u8005\u5176\u4ed6\u65b9\u5f0f\u3002\n\n\u7b2c\u4e8c\u6b65\u590d\u5236\u9ecf\u8d34\u5982\u4e0b\u5730\u5740\u6253\u5f00Windows Defender \u9632\u706b\u5899\u3002\n\n \u63a7\u5236\u9762\u677f\\\u6240\u6709\u63a7\u5236\u9762\u677f\u9879\\Windows Defender \u9632\u706b\u5899\n\n\u6700\u540e\u70b9\u51fb\u9ad8\u7ea7\u8bbe\u7f6e\uff0c\u9009\u62e9\u5165\u7ad9\u89c4\u5219\u3002\u5c31\u53ef\u4ee5\u770b\u5230\u591a\u4f59\u7684\u653e\u884c\u7aef\u53e3\u89c4\u5219\u3002\n"}