本地服务器域名重定向-可实现本地内测

@echo off&setlocal enabledelayedexpansion
cd/d "c:\Windows\System32\Drivers\Etc"
echo 127.0.0.1 localhost > hosts
set str1=192.168.0.X    www.xxoo.com 
set str2=192.168.0.X    www.ooxx.com 
(for /f "tokens=1* delims=:" %%i in ('findstr /n ".*" hosts')do (
  echo.%%j
  set hh=%%j
  set hh=!hh: =!
  if "!hh!"=="127.0.0.1localhost" ( echo.%str1% 
echo.%str2% 
)
))>yky.tem
move/y yky.tem hosts

 

posted @ 2013-12-02 13:41  xyzhuzhou  阅读(853)  评论(0编辑  收藏  举报