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

 

相关文章:

  • 2021-08-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-29
  • 2022-12-23
  • 2021-07-03
  • 2021-12-03
猜你喜欢
  • 2021-11-04
  • 2021-11-13
  • 2022-12-23
  • 2022-02-20
  • 2021-06-21
  • 2021-07-08
  • 2021-07-04
相关资源
相似解决方案