Option Explicit
Private Sub Command1_Click()
Call SyncTime
End Sub
'net time "\\OhterComputerName" /set /yes
'* 注意是本机和目标机器时间一致,服务器小心,同步电脑必须有访问权限 *
Public Sub SyncTime()
Dim strTimeSource As String
Dim strShellCmdLine As String
strTimeSource = "\\frt_Rec" '同步时间源
'Chr$(34)="
strShellCmdLine = "net time " & Chr$(34) & strTimeSource & Chr$(34) & " /set /yes"
Call Shell(strShellCmdLine)
End Sub