现在的位置: 首页 > 综合 > 正文

网关地址

2019年03月18日 ⁄ 综合 ⁄ 共 1211字 ⁄ 字号 评论关闭

Function addsheets(station)
Worksheets.Add after:=Sheets(Sheets.Count)  '在所有表最右边插入一表
ActiveSheet.Name = station '表名
End Function

Sub gateway()

Dim station, column1, column2, column3, column4 As String

column1 = 10

column4 = 1

Dim row_station_start, row_station_end, row_contractor_start, row_contractor_end As Integer

Dim i, j, k As Integer

k = 1

row_station_start = 12

row_station_end = 25

row_contractor_start = 31

row_contractor_end = 51

For i = row_station_start To row_station_end

    station = Worksheets("Sheet1").Cells(i, 1)
    
    column2 = Worksheets("Sheet1").Cells(i, 2)
    
    addsheets (station)
    
    For j = row_contractor_start To row_contractor_end
    
        column3 = Worksheets("Sheet1").Cells(j, 3)

        Cells(k, 1) = Worksheets("Sheet1").Cells(j, 1)
        
        Cells(k, 2) = Worksheets("Sheet1").Cells(j, 2)
        
        If column3 <> "" Then
        
            Cells(k, 3) = column1 & "." & column2 & "." & column3 & "." & column4
            
        End If
                
        k = k + 1
        
    Next j
    
    k = 1
        

Next i

End Sub

【新】
@echo off
setlocal enabledelayedexpansion
for /f "tokens=1,2,4 delims= " %%i in (WKT.txt)do (set station= %%i
set contractor=%%j
set ipaddr=%%k
for /f "delims=" %%m in ('ping -n 1 !ipaddr!^|find "TTL" ^&^& echo ping !ipaddr! 1 ^|^| echo ping !ipaddr! 0')do (
set str_ping=!date!!time! !station!-!contractor!
set str_ping=!str_ping! %%m
echo !str_ping!>>ping.txt)
)
pause

抱歉!评论已关闭.