Quantcast
Channel: windows –易春木
Viewing all articles
Browse latest Browse all 57

寫了一個修改route的batch檔 for Windows O.S

$
0
0

在windows寫一個batch檔控制route table路由
紀錄如下,

我會將電腦連接到另一外網, 而原本預設的gateway 10.55.11.253 要清掉
改成 10.x.x.x 與 110.x.x.x 的IP網址才經由 10.55.11.253 gateway出去
其他預設則皆由外網出去 (未加入batch裡)

@echo off
cls
:start
echo ----------------------------------
echo delete 0.0.0.0 mask 0.0.0.0 10.55.11.253
route delete 0.0.0.0 mask 0.0.0.0 10.55.11.253
echo delete 10.0.0.0 mask 255.0.0.0 10.55.11.253
route delete 10.0.0.0 mask 255.0.0.0 10.55.11.253
echo delete 110.0.0.0 mask 255.0.0.0 10.55.11.253
route delete 110.0.0.0 mask 255.0.0.0 10.55.11.253
echo add 10.0.0.0 mask 255.0.0.0 10.55.11.253
route add 10.0.0.0 mask 255.0.0.0 10.55.11.253
echo add 110.0.0.0 mask 255.0.0.0 10.55.11.253
route add 110.0.0.0 mask 255.0.0.0 10.55.11.253
echo ----------------------------------
echo Press any key to left
echo ----------------------------------
pause
echo Bye!
exit
  • echo off 是將這個 把bat位置和指令暴露出來的設定 取消
  • echo on 則是把這個設定開啟
  • CLS : Clears the video display screen, setting the cursor in the upper left-hand corner.
  • pause 是用來暫停程式,不然沒指令後程式會自我關閉 (PAUSE : Pauses the running of a batch file and displays the message “Press any key to continue …" on the screen. If the optional message is included, it will be displayed first. Use pause to optionally terminate the batch file with at a safe place. The optional message is not displayed when echo is OFF, so the message must be echoed on the preceding line.)

更多batch關鍵字查詢


Viewing all articles
Browse latest Browse all 57

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>