大网数据广告活动
网络与域名解析

Can't modify the Hosts or Lmhosts file

· 52CE 我爱测

This article provides a workaround for a problem that prevents you from modifying the Hosts file or the Lmhosts file.

This article provides a workaround for a problem in which you can't modify the Hosts file or the Lmhosts file.

Applies to:   Windows, all versions, and Windows Server, all versions
Original KB number:   923947

Symptoms

When you try to change the Hosts file or the Lmhosts file, Windows might deny you access to the file and then generate an error message that resembles either of the following messages.

  • Error message 1

    Access to C:\Windows\System32\drivers\etc\ hosts was denied

  • Error message 2

    Cannot create the C:\Windows\System32\drivers\etc\hosts file.
    Make sure that the path and file name are correct.

This problem occurs even though you sign in by using an account that has administrative credentials.

Workaround

  1. Select Start > All Programs > Accessories, right-click Notepad, and then select Run as administrator.

    If you're prompted for an administrator password or for a confirmation, type the password, or select Allow or Yes.

  2. Open the Hosts file or the Lmhosts file, make the necessary changes, and then select Save on the File menu.

Source: Microsoft Learn / IT Pro troubleshooting by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / IT Pro troubleshooting
适用范围
- Supported versions of Windows Server · Source date 02/12/2026
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。