Set WshShell=CreateObject("Wscript.Shell") Function Imput() imputport=InputBox("請(qǐng)輸入一個(gè)端口號(hào),注意:這個(gè)端口號(hào)目前不能被其它程序使用,否則會(huì)影響終端服務(wù)"," 更改終端端口號(hào)", "3389", 100, 100) If imputport<>"" Then If IsNumeric(imputport) Then
WshShell.RegWrite "HKLM/SYSTEM/CurrentControlSet/Control/Terminal Server/Wds/rdpwd/Tds/tcp/PortNumber",imputport,"REG_DWORD" WshShell.RegWrite "HKLM/SYSTEM/CurrentControlSet/Control/Terminal Server/WinStations/RDP-Tcp/PortNumber",imputport,"REG_DWORD" wscript.echo "操作成功" Else wscript.echo "輸入出錯(cuò),請(qǐng)重新輸入" Imput() End If Else wscript.echo "操作已經(jīng)取消" End If End Function Imput() set WshShell=nothing