幫小弟我解答個批處理檔案

2025-01-24 02:50:15 字數 1142 閱讀 8494

1樓:偽神之怒

echo off 隱藏回顯。

if exist del 若存在 則刪除他 [因為後段要把資訊寫入這個檔案,所以必須保證它為空]

ipconfig /all > 使用ipconfig命令,並把結果寫到 [這個是新建的]

if exist del 參考第一段。

find "physical address" > 在中找到關鍵字"physical address",並把這行寫入。

for /f "skip=2 tokens=12" %m in ( do set mac=%%m 獲得"physical address" 之後的mac位址[形如00-00-00-00-00-00],並把起值賦予變數mac

if exist del 參考1段。

find "ip address" >

for /f "skip=2 tokens=15" %i in ( do set ip=%%i [整段參考上段,這段是獲取ip位址並把值給變數ip]

arp -s %ip% %mac% 設定ip位址和mac位址為變數值。

deldeldelexitecho off

arp -s 00-3b-50-06-20-6b

exit 同上。

2樓:隆回網盟

echo off

if exist del

ipconfig /all >

if exist del

find "physical address" >for /f "skip=2 tokens=12" %m in ( do set mac=%%m

if exist del

find "ip address" >

for /f "skip=2 tokens=15" %i in ( do set ip=%%i

arp -s %ip% %mac%

前段執行ipconfig進行本地網路測試)del

deldel

刪除測試快取。

exit 退出。

echo off

arp -s 00-3b-50-06-20-6b強制路由位址及網絡卡實體地址。

exit 退出。

3樓:網友

給個**自己查查哦。

批處理檔案

只需一個檔案,執行一下即可。配置檔案可以由批處理生成。echo off set gs 北京賽爾福 for i in c e d f g h i do for f j in dir s b a d i userset.ini findstr gs do more 6 nx0 j goto eof 以下...

幫忙編寫下批處理,如何編寫批處理檔案?

看了補充了,就像我這樣寫就可以,只是在壓縮包裡三個檔案要在同一個目錄下,如果是子目錄就 folder 就可以。就把 和你的批處理檔案放在同一個目錄下。批處理寫 這是分割線 這是分割線 這樣就可以先執行直到其完成並關閉後,執行。只要下面4行就可以了。echo off cd d dp0 第二行的意思是把...

批處理檔案中的for語句

for 迴圈語句的一種 一般的計算機語言都有的一個關鍵字,重要是不要說的。其語法結構為 for 條件1 條件2 條件3 先舉個例子 以c語言為例 若要列印。可以是這樣 printf 1 printf 1 printf 1 printf 1 printf 1 必須使用for for int 1 0 i...