私人领地

一键切换hosts文件

1.新建文件host.bat

2.代码

@echo off

cd.>C:\Windows\System32\drivers\etc\hosts

echo 1.本地环境  2.线上测试环境 

set /p user_input=请输入1/2,切换Hosts文件内容:

if %user_input% equ 1 (
echo 127.0.0.1    www.xxx.com
echo 127.0.0.1   wap.xxx.com
echo 127.0.0.1   m.xxx.com
)>>C:\Windows\System32\drivers\etc\hosts

if %user_input% equ 2 (
echo 192.168.0.221    www.xxx.com
echo 192.168.0.221    wap.xxx.com
)>>C:\Windows\System32\drivers\etc\hosts


echo 切换成功

pause

 

posted @ 2017-06-27 10:35  狂奔的蜗牛Snails  阅读(372)  评论(0编辑  收藏  举报