keywords:windows7 ?bat自動批處理改變IP地址、DNS和代理設置
?
改變IP地址設置:
@echo off netsh interface ipv4 set address " 無線網絡連接 " static 192.168 . 100.200 255.255 . 255.0 192.168 . 100.1 netsh interface ipv4 set dns name= " 無線網絡連接 " source= static addr= 8.8 . 4.4 netsh interface ipv4 add dns name= " 無線網絡連接 " addr= 61.177 . 7.1 index= 2 echo ------------------------------------------------------------------------------ echo --------------------------------------------------------------------------------- echo -----------------------------
?
?
改為DHPC(自動獲取)設置:
@echo offf netsh interface ipv4 set address name= " 無線網絡連接 " source= dhcp netsh interface ipv4 set dns name= " 無線網絡連接 " source= dhcp echo ------------------------------
?
?
開啟IE代理服務器設置:
@echo off title 自動設置代理服務器 echo 正在設置代理服務器…… reg add " HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings " /v ProxyEnable /t REG_DWORD /d 1 / f reg add " HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings " /v ProxyServer /d " 192.168.100.100:808 " / f reg add " HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings " /v ProxyOverride /t REG_SZ /d "" / f echo 正在刷新設置…… ipconfig /flushdns
?
?
關閉IE代理服務器設置:
@echo off title 自動清除IE代理 echo 正在清空代理服務器設置…… reg add " HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings " /v ProxyEnable /t REG_DWORD /d 0 / f reg add " HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings " /v ProxyServer /d "" / f reg add " HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings " /v ProxyOverride /t REG_SZ /d 0 / f echo 代理服務器設置已經清空 echo 正在刷新設置…… ipconfig / flushdns
?
?
批處理自動選擇網絡設置全文
注:復制到記事本文件中,別存為,后綴改為”.bat”文件。在win7系統中運行時,會提示,“請求的操作需要提升為<作為管理員運行>”;只需要在此bat文件上右擊“以管理員身份運行”即可。
全文如下:
@echo off color 1f title windows 7 多網絡環境自動切換管理 echo. echo ******************************************** echo *** windows 7 雙網絡環寺自動切換管理 *** echo *** 作者:王明洪 MSN:kswmh@hotmail.com *** echo ******************************************** echo *** 設置IP參數,設置IE代理 *** echo. echo. goto menus :menus echo. echo 請選擇: echo. echo 1 切換到家庭代理網絡 echo. echo 2 切換到學校自動獲取IP地址網絡。 echo. echo 3 放棄設備,退出 echo. set /p select = 請輸入菜單對應數字后回車: if /i " %select% " == " 1 " goto home if /i " %select% " == " 2 " goto school if /i " %select% " == " 3 " exit goto menus :home cls netsh interface ip reset " 無線網絡連接 " echo 設置IP...設置網關.....設置子網 netsh interface ipv4 set address " 無線網絡連接 " static 192.168 . 100.200 255.255 . 255.0 192.168 . 100.1 echo 設置DNS... netsh interface ipv4 set dns name= " 無線網絡連接 " source= static addr= 8.8 . 4.4 netsh interface ipv4 add dns name= " 無線網絡連接 " addr= 61.177 . 7.1 index= 2 echo 設置IE代理... echo 正在設置代理服務器…… reg add " HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings " /v ProxyEnable /t REG_DWORD /d 1 / f reg add " HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings " /v ProxyServer /d " 192.168.100.100:808 " / f reg add " HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings " /v ProxyOverride /t REG_SZ /d "" / f echo 正在刷新設置…… ipconfig / flushdns goto exit :school cls echo 設置學校網絡自動IP地址. netsh interface ipv4 set address name= " 無線網絡連接 " source= dhcp echo 設置DNS... netsh interface ipv4 set dns name= " 無線網絡連接 " source= dhcp echo 正在清除代理服務器設置…… echo 正在清空代理服務器設置…… reg add " HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings " /v ProxyEnable /t REG_DWORD /d 0 / f reg add " HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings " /v ProxyServer /d "" / f reg add " HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings " /v ProxyOverride /t REG_SZ /d 0 / f echo 代理服務器設置已經清空 echo 正在刷新設置…… ipconfig / flushdns goto exit : exit cls echo. cho. echo. echo. echo. echo ************ 恭喜!網絡設置以完成。 echo. echo. echo. echo. echo. echo. pause exit
?
更多文章、技術交流、商務合作、聯系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
