If PortNumberNew = "" Then Exit Sub If Not ( ( IsNumeric( PortNumberNew ) = True ) And ( PortNumberOld <> PortNumberNew ) And _ ( PortNumberNew > 0 ) And ( PortNumberNew < 65535 ) ) Then wso.popup "输入错误,请重试!", 5 , "错误:修改失败", 16+4096 ' 提示信息 Exit Sub End If
PortNumberOld = regKeyRead("HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Terminal Server/WinStations/RDP-Tcp/PortNumber") If CLng( PortNumberOld ) = CLng( PortNumberNew ) Then wso.popup "修改成功,请重启电脑!", 5 , "提示:修改成功", 64+4096 Else wso.popup "修改失败,你可能没有权限!", 5 , "警告:修改失败", 48+4096 End If Set wso = Nothing End Sub
'=========================================================================================== '小函数 Function Exist( strPath ) 'On Error Resume Next Set fso = CreateObject("Scripting.FileSystemObject") If ((fso.FolderExists( strPath )) Or (fso.FileExists( strPath ))) then Exist = True Else Exist = False End if Set fso = Nothing End Function Sub Move( strSource, strDestination ) On Error Resume Next If Exist( strSource ) Then Set fso = CreateObject("Scripting.FileSystemObject") If (fso.FileExists(strSource)) Then fso.MoveFile strSource, strDestination If (fso.FolderExists(strSource)) Then fso.MoveFolder strSource, strDestination Set fso = Nothing Else WarningInfo "警告", "找不到 " & strSource & " 文件!", 2 End If If Not Exist( strDestination ) Then WarningInfo "警告", "移动失败,无法移动 " & VbCrLf & strSource & " 至" & VbCrLf & strDestination, 2 End Sub Sub RunHideNotWait( strCmd ) 'On Error Resume Next Set wso = CreateObject("WScript.Shell") wso.Run strCmd, 0, False Set wso = Nothing End Sub Function regKeyRead( strKey ) On Error Resume Next Set wso = CreateObject("WScript.Shell") regKeyRead = wso.RegRead( strKey ) 'strKey = "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/CurrentVersion/Run/DocTip" Set wso = Nothing End Function