在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 offcls:startecho ----------------------------------echo delete 0.0.0.0 mask 0.0.0.0 10.55.11.253route delete 0.0.0.0 mask 0.0.0.0 10.55.11.253echo delete 10.0.0.0 mask 255.0.0.0 10.55.11.253route delete 10.0.0.0 mask 255.0.0.0 10.55.11.253echo delete 110.0.0.0 mask 255.0.0.0 10.55.11.253route delete 110.0.0.0 mask 255.0.0.0 10.55.11.253echo add 10.0.0.0 mask 255.0.0.0 10.55.11.253route add 10.0.0.0 mask 255.0.0.0 10.55.11.253echo add 110.0.0.0 mask 255.0.0.0 10.55.11.253route add 110.0.0.0 mask 255.0.0.0 10.55.11.253echo ----------------------------------echo Press any key to leftecho ----------------------------------pauseecho 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.)
沒有留言:
張貼留言