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

[µo°Ý] Àx¦s®æªº¤º®e¡A¦p¦ó¦s¦¨§å¦¸ÀÉ¡H

[µo°Ý] Àx¦s®æªº¤º®e¡A¦p¦ó¦s¦¨§å¦¸ÀÉ¡H

B1¤ÎB2¤º®e¤À§O¬°100.12.22.1¤Î100.12.22.3¡A
­Y­n±NB1¤ÎB2ªº¤º®e¡A¤À§O¦s¬°1.BAT¤Î2.BAT¡A½Ð±ÐVBAµ{¦¡¸Ó¦p¦ó¼¶¼g¡HÁÂÁ¡I
Às

B1¤ÎB2¤º®e¤À§O¬°100.12.22.1¤Î100.12.22.3¡A
­Y­n±NB1¤ÎB2ªº¤º®e¡A¤À§O¦s¬°1.BAT¤Î2.BAT¡A½Ð±ÐVBAµ{¦¡¸Ó¦p ...
linderlong µoªí©ó 2013-8-29 19:28
  1.   Open ThisWorkbook.Path & "\1.bat" For Output As #1
  2.     Print #1, "ping " & [B1]
  3.   Close #1
  4.   
  5.   Open ThisWorkbook.Path & "\2.bat" For Output As #1
  6.     Print #1, "ping " & [B2]
  7.   Close #1
½Æ»s¥N½X

TOP

¦^´_ 2# luhpro
¤Q¤À·PÁ¡I¤w¸g¥i¥H¨Ï¥Î¡A¦ýµ{¦¡¹L©ó¤¾ªø¡A¤£ª¾¬O§_¯à°÷¥[¥H§ï¶i¡AÁÂÁ¡I

°²³] a1¦Üa10Àx¦s®æ¤º®e¤À§O¬°100.11.12.1¦Ü10¡Aping§¹«á¡A±Nµ²ªG¼g¦ÜB1¦ÜB10¡Aµ{¦¡¦p¤U¡G

Sub iptest()
  Columns("B:C").Select
  Selection.ClearContents

  '«Ø¥ß´ú¸Õip§å¦¸ÀÉ®×
  ¸ô®| = ThisWorkbook.Path & "\"
  For ¦C = 1 To 10
    ÀɦW = ¸ô®| & ¦C
    ¤º®e = "Ping -n 1 " & Cells(¦C, 1) & " > " & ÀɦW & ".txt"
    Open ÀɦW & ".bat" For Output As #1
    Print #1, ¤º®e
    Close #1
  Next ¦C
  
  ¶O®É = Timer
  
  '´ú¸Õip
  For ¦C = 1 To 10
    §å¦¸ÀÉ = ¸ô®| & ¦C & ".BAT"
     A = Shell(§å¦¸ÀÉ, 0)
  Next ¦C
   
  ¥ð®§ = Timer
  Do While Timer - ¥ð®§ < 4
  Loop
     
  'Ū¨úµ²ªG
  ¨t²Î = Application.OperatingSystem  
  For ¦C = 1 To 10
    ¤å¦rÀÉ = ¸ô®| & ¦C & ".TXT"
    ¥N½X = FreeFile    ' ¨ú±o¥¼¨Ï¥ÎªºÀÉ®×¥N½X¡C
    Open ¤å¦rÀÉ For Input As #¥N½X
    If Left(Right(¨t²Î, 4), 1) = 5 Then ¦r = LOF(¥N½X) Else ¦r = 80
    Cells(¦C, 2) = Input(¦r, #¥N½X)
    Close #¥N½X    ' Ãö³¬ÀɮסC
  Next ¦C
  
  [c1] = Timer - ¶O®É
  [a1].Select  
  ¥ð®§ = Timer
  Do While Timer - ¥ð®§ < 4
  Loop
  
  Kill ¸ô®| & "*.BAT"
  Kill ¸ô®| & "*.TXT"
End Sub
Às

TOP

        ÀR«ä¦Û¦b : ÁÀ¨¥¹³¤@¦·²±¶}ªºÂAªá¡A¥~ªí¬üÄR¡A¥Í©Rµu¼È¡C
ªð¦^¦Cªí ¤W¤@¥DÃD