客户机器名 Public Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long Function sGetComputerName() As String Dim sBuffer As String Dim lBufSize As Long Dim lStatus As Long lBufSize = 255 sBuffer = String$(lBufSize, " ") lStatus = GetComputerName(sBuffer, lBufSize) sGetComputerName = "" If lStatus <> 0 Then sGetComputerName = Left(sBuffer, lBufSize) End If End Function
在bat里面写:
telnet对方,然后执行操作
Public Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function sGetComputerName() As String
Dim sBuffer As String
Dim lBufSize As Long
Dim lStatus As Long
lBufSize = 255
sBuffer = String$(lBufSize, " ")
lStatus = GetComputerName(sBuffer, lBufSize)
sGetComputerName = ""
If lStatus <> 0 Then
sGetComputerName = Left(sBuffer, lBufSize)
End If
End Function