ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

´ú¸ÕIP

¦^´_ 1# linderlong
¸Õ¸Õ¬Ý¥Î¤U¦C Function ¬Ý¬Ý¡G
  1. Public Sub iptest()
  2.     MsgBox Ping("10.18.22.5")
  3. End Sub
½Æ»s¥N½X
  1. Private Function Ping(strAddr As String) As String
  2.     Dim strTmpFile As String
  3.    
  4.     strTmpFile = Environ("TEMP") & "\PingResult.txt"   '  ·Ç³Æ«Ø¼È¦sÀɦb Windows Temp ¥Ø¿ý¤U
  5.     '  «Ø¥ß WScript ª«¥ó Shell Ãþ§O , ¨Ï¥Î Run ¤èªk , ©I¥s¥~³¡«ü¥O Ping ( ¨Ãµ¥«Ý¨ä°õ¦æµ²§ô )
  6.     CreateObject("WScript.Shell").Run Environ("COMSPEC") & " /c PING " & strAddr & " > " & strTmpFile, 0, True
  7.     '  PS : "Ping IP¦ì¸m > XXÀÉ®×" ³o¸Ì¬O¨Ï¥Î > ¨Ó±N Ping µ²ªG¼g¨ìÀɮ׸Ì
  8.     '  ( ·íµM¤]¥i Call API CreatePipe ¨ÓŪ¨ú©R¥Oµ²ªG )
  9.     '  Ping ¬O¤@ºØ¤½¥Îµ{¦¡¡A¥i¥HÅçÃÒ¤@©Î¦h­Ó»·ºÝ¥D¾÷³s½u¡C
  10.     '  Ping «ü¥O¥Î ICMP ¦^À³­n¨D©M¦^À³¦^ÂЮM¸Ë³nÅé¨Ó¨M©wºô¸ô¤Wªº¯S®í IP ¨t²Î¬O§_¥¿±`¹B§@¡C
  11.     '  Ping ¹ï¶EÂ_ IP ºô¸ô©Î¸ô¥Ñ¾¹¥¢±Ñ«D±`¦³¥Î¡C
  12.     '  Internet Control Message Protocol (ICMP)
  13.     '  TCP/IP ²Õ¥ó¤¤¥²­nªº¤@ºØºûÅ@³q°T¨ó©w¡A¥i³ø§i¿ù»~¨Ã¤¹³\²©ö³s½u¡C
  14.     '  Ping ¤u¨ã¥Î¨Ó°õ¦æ TCP/IP ºÃÃø±Æ¸Ñªº ICMP¡C
  15.     '  ¸Ô²Ó»¡©ú¤Î¥Îªk¥i°Ñ¦Ò:
  16.     '  ms-its:%WINDIR%\Help\ntcmds.chm::/ping.htm
  17.     '  ms-its:%WINDIR%\Help\ntcmds.chm::/ping.htm
  18.     '  ms-its:%WINDIR%\Help\tcpip.chm::/sag_TCPIP_pro_PingConnect.htm
  19.     '  ms-its:%WINDIR%\Help\tcpip.chm::/sag_TCPIP_pro_Ping.htm
  20.     '  «Ø¥ßÀɮרt²Îª«¥ó,¥Î¨Ó¶}±Ò¼È¦s¤å¦rÀÉ,¨ÃŪ¨ú¤º®e ( ¨ú¦^ Pingªºµ²ªG )
  21.     Ping = CreateObject("Scripting.FileSystemObject").OpenTextFile(strTmpFile).ReadAll
  22.     Ping = Replace(Ping, vbCrLf, "", 1)
  23.    
  24.     On Error Resume Next
  25.     Kill strTmpFile         '  §R°£¼È¦sÀÉ
  26. End Function
½Æ»s¥N½X

TOP

¦^´_ 3# linderlong
§Ú³s¤W Google ¬ù»Ý¤­¬í¡A¦p¤U¹Ï©Ò¥Ü¡G

¦p¥H .1 ¨ì .10 ­n 45 ¬í (°»´ú¥~³¡ IP)¡A
À³¬O¦X²z½d³ò¡C

TOP

¥»©«³Ì«á¥Ñ c_c_lai ©ó 2013-8-28 14:33 ½s¿è

¦^´_ 5# linderlong
§A¸ÕµÛ¥Î Shell command ªº¤è¦¡°õ¦æ¬Ý¬Ý¡G
  1. Sub Test()
  2.     Dim strIP As String, sp As Variant, RetVal
  3.     Dim cts As Integer, xi As Integer
  4.    
  5.     strIP = "100.18.22.1,100.18.22.2,100.18.22.3,100.18.22.4,100.18.22.5,100.18.22.6,100.18.22.7,100.18.22.8,100.18.22.9,100.18.22.10"
  6.    
  7.     sp = Split(strIP, ",")
  8.     cts = 0
  9.     For xi = 0 To UBound(sp)
  10.         cts = cts + 1
  11.         '  RetVal = Shell("command.com /c Ping -n 1 100.18.22.1 > D:\iptest\1.txt")
  12.         RetVal = Shell("command.com /c Ping -n 1 " & sp(xi) & " > " & ThisWorkbook.Path & "\iptest" & cts & ".txt")
  13.         ¤u§@ªí1.Cells(cts, 1) = sp(xi)
  14.     Next xi
  15. End Sub
½Æ»s¥N½X

TOP

¦^´_ 8# linderlong
½Ð±N Cells(i, 1) ©ú½T«ü©w ¤u§@ªí³æ¤§ÂkÄÝ¡C
Ä´¦p¡G Sheet1.Cells(i, 1) µ¥¡C

TOP

¦^´_ 10# linderlong
  1.         RetVal = Shell("command.com /c Ping -n 1 " & ¤u§@ªí1.Cells(cts, 1) & " > " & ThisWorkbook.Path & "\iptest" & cts & ".txt")
½Æ»s¥N½X
¸g¹ê¦a¦b Excel 2010  ¤U´ú¸Õ¬OµL»~ªº¡A
½ÐÀˬd§Aªº°õ¦æ¿ù»~ÂI¬O¦b­þ¤@¬q¡H

TOP

¦^´_ 10# linderlong

TOP

¦^´_ 14# linderlong
¸ÕµÛ¦b WinX 64 ¦ì¤¸Àô¹Ò¤U´ú¸Õ¬O§_OK¡H

TOP

¦^´_ 14# linderlong
§Aª½±µ±N Debug µe­±§¹¾ã Copy ¤W¶Ç (»Ý¦³¿ù»~ÂI«ü¦V)

TOP

¦^´_ 18# linderlong
RetVal  ¤W¦æ´¡¤J DoEvents ¸Õ¸Õ¬Ý¡C
  1.     DoEvents
  2.     RetVal = Shell("command.com /c Ping -n 1 " & Cells(i, 1) & " > " & ThisWorkbook.Path & "\" & i & ".txt")
½Æ»s¥N½X

TOP

¦^´_ 20# linderlong
³o¬O§Aºô¸ôÅv­­¤£°÷ªº½t¬G¡C
¥ç§Y Users' ªºÅv­­¤£¨¬µLªk«ü¨ì Windows/system32/ ªº¸ô®|¡C

TOP

        ÀR«ä¦Û¦b : «Î¼e¤£¦p¤ß¼e¡C
ªð¦^¦Cªí ¤W¤@¥DÃD