使用vb6.0做UI  傳送參數 到批次檔內

批次檔執行 tracert 命令

並且在 vb的UI 做顯示

解決一般中文亂碼問題(在批次檔內將所有中文去除,並竟那些中文很多餘)

以下是全部程式,紅色部分是檔案的路徑,要依自己情況做修改

——————————————battracert.bat—————————————————

@setlocal
@echo off
set server=%1
tracert %server% > tracerlog.txt
find tracerlog.txt “:" > tracerlog2.txt
for /f “tokens=2,3″ %%i in (tracerlog2.txt) do set a=%%i,%%j
echo %a%%b% > tracerlog2.txt
find tracerlog.txt “ms" >> tracerlog2.txt
find tracerlog2.txt /v “TRACERLOG.TXT" > tracerlog.txt
del tracerlog2.txt
@endlocal

——————————————vb6.0—————————————————

Dim tracerta As String

tracera = Text1.Text
Shell “C:\Users\LIOU\Desktop\VBTracert\battracert.bat " & tracera, vbHide
Open “C:\Users\LIOU\Desktop\VBTracert\tracerlog.txt" For Input As #1
Text2.Text = Input(LOF(1), 1)
Close #1

廣告