2015-03-31 21 views
0

我正在尋找一個可以不斷ping通服務器的批處理腳本。當ping失敗時,會有邏輯來停止ping,然後禁用並啓用網絡適配器。批處理腳本不斷ping,當失敗時使用邏輯來禁用和啓用網絡適配器

+0

查看答案(http://stackoverflow.com/questions/3050898/how-to-check-if-ping-responded-or- [這個問題。]不在批處理文件)它執行一個非常類似的任務,你所尋找的。如果您需要澄清任何事情,請在評論中加上標籤並讓我知道。 – CalebB 2015-03-31 15:40:34

回答

1

事情是這樣的:

@echo off&cls 

:loop 
Echo connection Test... 
ping www.google.com >nul || (
    Echo Reseting the connection... 
    netsh interface set interface "Name of the connection" Disable 
    netsh interface set interface "Name of the connection" Enable 
) 
::Change the value (300) to in/decrease the time value between 2 tests 
ping localhost -n 300 >nul 
goto:loop 
相關問題