随便写个bat存档
@echo off @COLOR 2 @echo ------------切换Hosts环境--------------- :Again @set /p choice="切换模式:A:应用环境,T:测试环境,E:退出【A,T,E】" @if %choice% equ A goto GoA @if %choice% equ a goto GoA @if %choice% equ T goto GoT @if %choice% equ t goto GoT @if %choice% equ E goto GoExit @if %choice% equ e goto GoExit goto GoEnd :GoA copy hostsApp /y hosts goto GoEnd :END :GoT copy hoststest /y hosts goto GoEnd :END :GoEnd @echo 切换成功 goto Again :END :GoError @echo 选择错误,重新选择 goto Again :END :GoExit @echo 已退出 pause; :END :END