Dim psi As New System.Diagnostics.ProcessStartInfo()
psi.FileName = "C:\WINDOWS\system32\cmd.exe"
psi.Arguments = "D:\execise\SE004.bat"
psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Maximized
Dim proc As Process
proc = System.Diagnostics.Process.Start(psi)
proc.WaitForExit()
小日本的网速有点问题,改一下,用下面的,可以判断了。当前是否连接了网络。
@echo off
set /a timeVal = 0
set /a WaitTime = 0
set /a OnLineTime = 0
:WaitForConnection
rem title Off Line
if %timeVal% GEQ 27 cls
if %timeVal% GEQ 27 set /a timeVal = 0
rem 跑马灯标题
if %WaitTime% EQU 8 Set /a WaitTime = 0
if %WaitTime% EQU 0 title Off Line
if %WaitTime% EQU 1 title _Off Line
if %WaitTime% EQU 2 title __Off Line
if %WaitTime% EQU 3 title ___Off Line
if %WaitTime% EQU 4 title ____Off Line
if %WaitTime% EQU 5 title ___Off Line
if %WaitTime% EQU 6 title __Off Line
if %WaitTime% EQU 7 title _Off Line
rem 为了减轻sohu压力,打击日寇,ping对象改变
rem ping www.sohu.com -n 1 -w 150 > nul
ping www.japan.com -n 1 >nul
if not errorlevel 1 set /a OnLineTime = 0
if not errorlevel 1 title On Line
if not errorlevel 1 goto ListenToConnection
echo Request TimeOut
set /a timeVal += 1
set /a WaitTime += 1
goto WaitForConnection
:ListenToConnection
rem title On Line
if %timeVal% GEQ 27 cls
if %timeVal% GEQ 27 set /a timeVal = 0
rem 跑马灯标题
if %OnLineTime% EQU 8 Set /a OnLineTime = 0
if %OnLineTime% EQU 0 title On Line
if %OnLineTime% EQU 1 title _On Line
if %OnLineTime% EQU 2 title __On Line
if %OnLineTime% EQU 3 title ___On Line
if %OnLineTime% EQU 4 title ____On Line
if %OnLineTime% EQU 5 title ___On Line
if %OnLineTime% EQU 6 title __On Line
if %OnLineTime% EQU 7 title _On Line
rem 为了减轻sohu压力,打击日寇,ping对象改变
rem ping www.sohu.com -n 1 -w 150 > nul
ping www.japan.com -n 1 >nul
if errorlevel 1 set /a WaitTime = 0
if errorlevel 1 title Off Line
if errorlevel 1 goto WaitForConnection
echo Request internet successful!
rem echo Ping 小日本 OK!
set /a timeVal += 1
set /a OnLineTime += 1
goto ListenToConnection
set /a WaitTime = 0
set /a OnLineTime = 0
:WaitForConnection
rem title Off Line
if %timeVal% GEQ 27 cls
if %timeVal% GEQ 27 set /a timeVal = 0
rem 跑马灯标题
if %WaitTime% EQU 8 Set /a WaitTime = 0
if %WaitTime% EQU 0 title Off Line
if %WaitTime% EQU 1 title _Off Line
if %WaitTime% EQU 2 title __Off Line
if %WaitTime% EQU 3 title ___Off Line
if %WaitTime% EQU 4 title ____Off Line
if %WaitTime% EQU 5 title ___Off Line
if %WaitTime% EQU 6 title __Off Line
if %WaitTime% EQU 7 title _Off Line
rem 为了减轻sohu压力,打击日寇,ping对象改变
rem ping www.sohu.com -n 1 -w 150 > nul
ping www.japan.com -n 1 -w 70 >nul
if not errorlevel 1 set /a OnLineTime = 0
if not errorlevel 1 title On Line
if not errorlevel 1 goto ListenToConnection
echo Request TimeOut
set /a timeVal += 1
set /a WaitTime += 1
goto WaitForConnection
:ListenToConnection
rem title On Line
if %timeVal% GEQ 27 cls
if %timeVal% GEQ 27 set /a timeVal = 0
rem 跑马灯标题
if %OnLineTime% EQU 8 Set /a OnLineTime = 0
if %OnLineTime% EQU 0 title On Line
if %OnLineTime% EQU 1 title _On Line
if %OnLineTime% EQU 2 title __On Line
if %OnLineTime% EQU 3 title ___On Line
if %OnLineTime% EQU 4 title ____On Line
if %OnLineTime% EQU 5 title ___On Line
if %OnLineTime% EQU 6 title __On Line
if %OnLineTime% EQU 7 title _On Line
rem 为了减轻sohu压力,打击日寇,ping对象改变
rem ping www.sohu.com -n 1 -w 150 > nul
ping www.japan.com -n 1 -w 70 >nul
if errorlevel 1 set /a WaitTime = 0
if errorlevel 1 title Off Line
if errorlevel 1 goto WaitForConnection
echo Request internet successful!
rem echo Ping 小日本 OK!
set /a timeVal += 1
set /a OnLineTime += 1
goto ListenToConnection