- 积分
- 146
- 最后登录
- 2023-12-25
- 精华
- 0
- 阅读权限
- 20
- 主题
- 30
- UID
- 814169
- 帖子
- 289
- PB币
- 422
- 威望
- 5
- 贡献
- 0
- 技术
- 0
- 活跃
- 545
- UID
- 814169
- 帖子
- 289
- PB币
- 422
- 贡献
- 0
- 技术
- 0
- 活跃
- 545
|
10F
发表于 2019-11-2 19:09:26
IP属地新疆
|只看该作者
发两段批处理
1、编辑Hosts
- @echo 如果你被提示因为权限问题而拒绝保存,请以管理员身份运行后再编辑Hosts
- @notepad "%SystemRoot%\system32\drivers\etc\hosts"
- @ipconfig /flushdns
- @echo 正在刷新缓存,程序会自动退出。。。
- @exit
复制代码
2、还原Hosts
- @Echo Off
- Title 一键还原Hosts
- Pushd %~dp0
- If "%PROCESSOR_ARCHITECTURE%"=="AMD64" (Set b=%SystemRoot%\SysWOW64) Else (Set b=%SystemRoot%\system32)
- Rd "%b%\test_permission_JayXon" 2>nul
- Md "%b%\test_permission_JayXon" 2>nul||(Echo 请使用右键管理员身份运行后再还原Hosts&&Pause >nul&&Exit)
- Rd "%b%\test_permission_JayXon" 2>nul
- Set p=Profiles
- SetLocal EnableDelayedExpansion
- :Menu
- Cls
- del %windir%\System32\drivers\etc\hosts>nul 2>nul
- (
- echo # Copyright c 1993-2009 Microsoft Corp.
- echo #
- echo # This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
- echo #
- echo # This file contains the mappings of IP addresses to host names. Each
- echo # entry should be kept on an individual line. The IP address should
- echo # be placed in the first column followed by the corresponding host name.
- echo # The IP address and the host name should be separated by at least one
- echo # space.
- echo #
- echo # Additionally, comments such as these may be inserted on individual
- echo # lines or following the machine name denoted by a '#' symbol.
- echo #
- echo # For example:
- echo #
- echo # 102.54.94.97 rhino.acme.com # source server
- echo # 38.25.63.10 x.acme.com # x client host
- echo,
- echo # localhost name resolution is handled within DNS itself.
- echo # 127.0.0.1 localhost
- echo # ::1 localhost
- )>%windir%\System32\drivers\etc\hosts
- ipconfig /flushdns
- ECHO.&ECHO.已成功还原Hosts,请按任意键退出! &PAUSE >NUL 2>NUL
复制代码
|
|